I am embedding a small area of a large webpage into a document compiled with pdflatex (using \includegraphics). A raster image / screenshot produces artifacts when zooming in, so instead I am saving the page as a PDF with the browser's print dialog, and cropping the section I need.

$ pdfcrop --margins "-50 -65 -40 -400" full-page.pdf area.pdf

This tool changes the bounding box, and produces the desired visual appearance. But the file preserves all the content of the original.

$ ls -lh *.pdf
-rw-rw-r-- 1 user group 7.1M Apr 27 14:48 area.pdf
-rw------- 1 user group 7.1M Apr 27 14:02 full-page.pdf

There is personal information contained outside the bounding box I would like to ensure is not in the cropped pdf (usernames, timestamps, ids, etc.). Given a string of ascii plaintext in the original document, e.g. my username, how would i go about finding whether it's present in the PDF. Can I expect ascii text from the page to be contained literally or would it be encoded in some vectorial form?

I mention that the file is coming from a browser, because intuitively, browsers might encode their printed PDFs in a predictable way, maybe it's easy to clip areas if it maps to the DOM directly.

pdf2ps experiment

I've converted the pdf to ps and back (pdf2ps, followed by ps2pdf) and that did trim the file size down drastically, but without knowing exactly how to interpret the contents of the file, or knowing what's involved in those conversions, I can't be certain whether the content I want to get rid of is finally gone, hidden, or simply spatially re-optimized /compressed.

$ pdf2ps area.pdf && ps2pdf area.ps
$ ls -lh *.pdf
-rw-rw-r-- 1 user group 259K Apr 27 14:59 area.pdf
-rw------- 1 user group 7.1M Apr 27 14:02 full-page.pdf

The initial page is mostly fonts and lines, with the exception of a few icons. The fonts however are CJK. Everything in the end looks good at any scale, so it does seem vector paths are preserved via a conversion.

Edit: Rephrasing question in light of a similar question about stripping content with pdfcrop (I'd missed it in my search before writing here). I'm more interested in ensuring that some of the text data is not in the pdf at this point. I'm asking this community because of familiarity its users have with embedding documents of the sort, as well as with the underlying formats involved.

closed as off-topic by Martin Schröder, clemens, Schweinebacke, Stefan Pinnow, gernot May 4 '17 at 15:18

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question does not fall within the scope of TeX, LaTeX or related typesetting systems as defined in the help center." – Martin Schröder, clemens, Schweinebacke, Stefan Pinnow, gernot
If this question can be reworded to fit the rules in the help center, please edit the question.

  • Can you save it as .eps file? Or convert the .pdf to .eps? – Bernard Apr 27 '17 at 21:39
  • eps has a concept of bounding boxes too though, no? Is there some guarantee that data that I can't see visually won't be present in the underlying file? will going to eps and back produce a pdf with 0,0,0,0 bounding box? -- edit (I meant no bounding box) – init_js Apr 27 '17 at 21:41
  • You can change the bounding box by hand. However a bounding box of 0,0,0,0 consists of only… 1 point. You can check the cropping resulting files with gsview (on Windows) or Ghostview (Linux, and probably Mac OS). – Bernard Apr 27 '17 at 21:44
  • That won't remove the data though. Just change which portion of it is visible. – init_js Apr 27 '17 at 21:46
  • 1
    Whatever you do, don't try this: infosecurity-magazine.com/news/… – JPi Apr 28 '17 at 0:59