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.
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.