How to get rid of whitespace when printing documents? - pdf

A PDF with lecture slides contains huge whitespaces (ca. 50% of actual slide dimensions on each border). How can I get rid of those in a printout?
NOTE: Printer settings are not useful. Zooming is not possible, as this immediately cuts into one side of the slides and toggling automatic centering does not solve this issue either. Need document level solution!
Is there a function for this in common word processing programs? I have imported the PDF into LibreOffice Draw. The slides are imported as images, but I do not want to rescale 60 images on 30 pages by hand:
Source: http://www.cs.toronto.edu/~kyros/courses/418/Lectures/lecture.2010f.02.pdf

Related

Printing multiple pages on one page in landscape orientation

I'm trying to print four landscape-oriented pages of a document in a grid on one page in landscape-orientation using VBA with:
ActiveDocument.PageSetup.Orientation = wdOrientationLandscape
ActiveDocument.PrintOut PrintZoomRow:=2, PrintZoomColumn:=2
This however is printing the four small landscape-oriented pages in a grid on a portrait-oriented page, which leaves them too small and with too much free space between them vertically.
I looked at the documentation for PrintOut, but didn't find anything concerning orientation.
I tried reversing the order of the PrintZooms.
I also tried manually configuring the width and height of the printed paper with PrintZoomPaperWidth and -Height, which lead to the small pages being cut off and the printing one still in portrait mode.
This just doesn't seem to be possible in the current version of Office (2019), neither with code nor the UI.
As a workaround, one could take screenshots, change the orientation to portrait and paste them in rotated 90° or use rotated textboxes in Word.
Alternatively and probably much easier, create a PDF and use a PDF reader capable of printing this way, e.g. Adobe Reader.

Unwanted lines appearing between semi-transparent elements in PDF output (generated with puppeteer)

I've been working on a node project with puppeteer.js for the last few months, but I have just started to use transparency in PDF files and have come across a real head scratcher...
What am I trying to achieve?
3 horizontally adjoined, semi transparent divs, rendered as part of a pdf via puppeteer.
What's the problem?
In html they display as expected. But in PDF a faint line appears between elements which I believe is to do with "stitching". I'm aware that this wont show in print, but I want to get rid of on screen. This is a mock up of some simple content which shows the behaviour I'm experiencing:
What have I tried?
Experimenting with Puppeteer params (antialiasing, flattening, color
flags like -webkit-print-color-adjust) - [Result: no change]
SVG elements with transparent background. [Result: lines still
appear]
A single div using a linear gradient with 3 block colors. [Result: Works when viewed in Acrobat, but has the weird effect in chrome where elements shift slightly to the right (pictured: top row - single div with linear gradient. Bottom row - black boxes used here as a guide for assessing alignment)].
SVG elements using a linear gradient. [Result: Same as above]
Flattening the pdf [Result: This does solve the problem, but degrades
the quality of the rest of the image, therefore not suitable]
I'm finding it difficult to find a solution as I'm not really sure where the behaviour is emanating from (the PDF, puppeteer, browser?). If anybody has any ideas, I'd be very grateful!
Thanks

Vector graphics artefacts: saving Powerpoint graphics to PDF results in blurred pixels

I have used Powerpoint 2016 to create a complex plot, based on an imported EMF graph saved from Matlab and some line drawings added in Powerpoint. I would like to save the entire contents of the Powerpoint slide as a PDF or EPS file, so as to have the figure as zoomable (as vector graphics).
Selecting the entire slide contents and right-clicking SavePictureAs only gives me EMF as the only vector graphics option, so instead I saved the entire presentation (consisting of a single slide) as a PDF. However, several parts of the image (those that were imported as a vector graphics EMF from Matlab) appear blurred in the saved PDF:
.. even though they look fine when viewed in Powerpoint:
Here is another example of a figure that looks fine in Powerpoint but blurred when saved as PDF:
I also tried some online converters to go from EMF (which Powerpoint can save into) to either PDF or EPS, but each of those produce its own type of artefact.
Can anyone suggest a solution to save this Powerpoint content into an artefact-free PDF or EPS file?
z8080 and I have been following up on this in Microsoft Answers' PowerPoint forum, but I thought I'd come back and fill in what we've learned.
In the second example above, the grid is actually not vector graphics. It's a 7x7 pixel image. Each of the squares in the grid is actually a single pixel, blown WAY up.
Problem is, when PowerPoint prints/saves as PDF, it wants to "help" by antialiasing and upscaling the image to eliminate the jaggies. With most ordinary photos, this is usually A Good Thing. In this case, not.
To make matters worse, the slide size of z8080's presentation is quite large, which seems to cause PPT to upscale to a much larger number of pixels than it ordinarily would. I found that if I created a new presentation at the normal default slide size and pasted the graphic from z8080's presentation into it, the resulting PDF looked much more like the original slide, as expected.

Split long PDF page into mutiple pages

What is the best method for splitting one very long pdf page into seperate pages? In this case, the one page image is made up of what was originally multiple letter size pages that have a black line where each page should be divided. To be clear, it is a single PDF document, with a single page. The single page is an image of hundreds of pages, so it is a very long image.
https://filebin.net/h2wiqckndsugnr1o/sample_pdf_long3.pdf
The pages wihin the image are not consistently the same size because white space was removed on some of the letter sized pages,so some are longer than others.
This explains the issue: https://dustinfreeman.org/blog/pdf-splitting/ However, they don't have a solution to fix that the page breaks are not aligned correctly.
Is there a software, or solution to programically do extract the single image into multiple pages in the single pdf document?
I would suggest you to use this approach
Create XObject from the contents of the first page.
Create a number of smaller pages.
Draw the XObject on each page using negative top offset.
Different parts of the XObject will be visible on different pages. Size of the file won't increase much because the image will be reused.
You will need to calculate the top offset and size for each page. You can do this manually, of course. Or you can use some kind of computer vision algorithms to find horizontal black lines. You will have to extract image first. Given the array of coordinates for these lines you will be able to calculate page bounds.

PDF - Mass cropping of non-whitespace application

I have about 400 pdfs with a lot of dead space between the text and the page border.
Usually I'm using govert's pdf cropper to crop all the whitespace, but this time the pdf background color is (darn!) yellow,
and no software which I know (and I've searched for quite a while) can crop non-whitespace
(well, except maybe pdfcrop.pl -a Pearl library which supposedly can remove black spaces).
Anybody knows of a software that can perform such task?
The ideal app, I guess, would have the option to receive specific color to remove,
like rgb(192,192,192).
Thanks in advance.
The reason this is so difficult is that PDF has no concept of paper color or background color. So what you're seeing is not a different background color, but an object (typically a rectangle) painted in that yellow background color.
Most cropping tools simply calculate the bounding box of all objects on the page and then crop away everything outside that bounding box. Of course that doesn't work for your file because the bounding box will include the background rectangle object.
There are potentially a number of directions you could take this:
1) If all pages need to be cropped by the same amount, you could attempt to do cropping that way (simply passing a rectangle to the cropping tool to do the actual cropping).
2) There are tools (callas pdfToolbox - watch it, I'm associated with this tool, Enfocus PitStop...) that allow you to remove objects from a document and this could be done by specifying your yellow color. This would allow you to modify the PDF file by removing the background object and then perform the cropping you want to perform.