[Ultimate PDF] Extend ScreenToPDF layout with paper size / margin size?
Forge component by Leonardo Fernandes
Published on 08 Jan 2021
Application Type
Traditional Web
Service Studio Version
11.8.13 (Build 32892)

First of all, awesome job on UltimatePDF !

I'm working on previewing a pdf with no margins. The layout ScreenToPDF is really helpful to show a pdf by a single web screen, especially without downloading it first. The only thing I miss is the ability to set the margin size (and possibly the paper size, but for now it's always A4).

Is it possibly to extend this functionality with those 2 parameters (or add a new one to save backwards compatibility)?

This would then be pretty similar to the server actions PrintToPDF and PrintToPDF_Advanced.



Rank: #514

Hi Geertjan,

You can use the PrintLayout to set this, which is also part of ultimate pdf.

They actually have a PaperSize and MarginSize option.

The way this works is by adding it to the the screenToPdf..

I've added a print screen to help you out in case my descriptions wasn't clear.

Hope this solves your problem.

Kind regards,



Rank: #8036

Thanks. I tried your solution, but it still ignores the no-margin setting. Do you have an example of this scenario working?

Rank: #514

Hi GeertJan,

That is quite odd.  I've added a screenshot of my setup and it seems to doesn't take the margin into account. Only that margin that is already set by the css classes. 

I hope this helps you out.

Kind regards,


ps: Apparantly I can only add one image if I don't want it inline I've also added the image of the generated pdf below:


Rank: #8036

Very odd. I guess it's caused by the content I'm using (image on full width/height of the page).

I fixed/worked around it by using the same pattern UltimatePDF is using in ScreenToPDF itself: setting the proper variables on action:


and then using the standard Download action with parameter SaveToDisk=No.

Rank: #514

Hmm interesting case. I guess the image may do some funky stuff.

Glad you found a workaround though!

Good to know.

Have a nice day.

Kind regards,