When I save a webpage with Safari's > File > Export as PDF...
Safari renders a long PDF in several (long) pages.
Here a screenshot of Preview's Crop Inspector, 200 inch seems to be the height values for each page.
Sometimes have over 10 pages because the webpages get pretty long with +100 comments.
So now I want to crop, tile or posterize these long pages into normal height.
I want to read them in portrait orientation on on old iPad 2 which has a screen resolution of 768px x 1024px.
The PDF I saved with Safari has already the 768px width because I used the Responsive Design Mode
I tried following tools to crop / tile / posterize the long pages:
ADOBE ACROBRAT PRO DC
Print > Page Sizing & Handling > Poster > Print
! The app crashes
Never been able to get the crop arguments to work from the command line
Auto cropping to a certain height does not work, even not in GUI mode
Seems to work but can't set the margins to zero, get rid of the trim marks and set the
Error in the Terminal
pdfposter: error: The input-file is either currupt or no PDF at all: Invalid Elementary Object starting with b'b' @7: b'3\n%\xc4\xe5\xf2\xe5\xeb\xa7\xf3\xa0\xd0\xc4\xc6\n3 0 obj\n<< /Filter /FlateDecode /Length 19229 >>\nstream\nx\x01\xd5\xbdi\x97\x1c\xc7\x95'
I don't get it, the webpage is saved to PDF by Safari and corrupt?
- UPDATE 1: I managed something in PDFPOSTER, after "repairing" the PDF
I have set the height of the
--poster-sizeBOX to something really long: 100000pt
pdfposter -v -m 768x1024pt -p 768x100000pt in.pdf out.pdf
That works for both pages, one after the other, but I can’t find a solution to set the Y coordinates of each page to 0 The pages always seem to start from the bottom of the poster size, leaving space at the top..
- UPDATE 2: attached a few pictures as why Safari > File > Print is NOT an option for me.
- It leaves me with borders unable to remove
- Dark Mode is not applied
- Responsive layouts are not applied
- UPDATE 3:
The last days I tried out libraries, toolkits, bindings, command line tools, modules, recipes ecc. like a mad man, but today I finally found my peace with PYPDF
Now that I played around long enough with this Cropping and Transforming example I am confident I can do what I want.
Basically with PYPDF you define:
reader = PdfReader('mypdf.pdf')
writer = PdfWriter()
I than loop over the pages
page_x = reader.pages[i] from the input file, set mediaboxes for each "new" page and add it to the writer
Finally write out with
Hyperlinks remain intact! 🤘