Developer forum

Forum » CMS - Standard features » Removing margin from printed PDF

Removing margin from printed PDF

Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Hi there,

 

Is there a way to remove the margin on the page for printed PDFs (using pdf=true)? Currently there's about half an inch of margin on all four sides and I would like to get rid of that.

 

Imar


Replies

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Bump..... Anyone? Can this be configured on the server somehow?

 

Imar

 

 
Nicolai Høeg Pedersen
Reply

Hi Imar

 

You cannot control that. The margin is 10mm on each of the four sides.

 

Changed the feature so you can control the margin using leftRightMargin=10&topBottomMargin=10 in the querystring.

 

Since I know you are working on a US site, you might also have the need to control the papersize? DW creates the PDF in A4 but in us they might need the size Letter?

 

BR Nicolai

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Hi Nicolai,

 

Yes, being able to set the page size would certainly makes sense. I like that idea.

 

Would it also be an option to make it possible to configure the margin and page size in the Control Panel as a default value? That way, you don't have to hard code it into your links all over the place.

 

Thanks!

 

Imar

 
Lars Sørensen
Reply

Hard code links? Using website items is a great alternativ to that:-)

 
Nicolai Høeg Pedersen
Reply

OK, this is what you have as of 8.4, TFS#14102

 

When doing ?pdf=true a couple of new parameters are now available:

&leftRightMargin=10 (Controls the left and right margin in mm)

&topBottomMargin=10 (Controls the top and bottom margin in mm)

&letter=true (changes the papersize from A4 to US Letter format)

&landscape=true (turns the paper to be landscape instead of horisontal)

 

will consider settings in MC

 

BR Nicolai

 
Lars Sørensen
Reply

Setting landscape or size to letter rather than A4 is quite a big decision for an entire solution. Settings for individual websites may be appropriate, or perhaps like PageFeatures so you can set up settings for individual print definisions.

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

>> Hard code links? Using website items is a great alternativ to that:-)

 

I already use item types. How would they help to prevent adding query string parameters to multiple templates? I have PDFs all over the place: on items, ecommerce products and more...

 

Imar

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

>> OK, this is what you have as of 8.4, TFS#14102

 

Cool! Thanks.

 

Imar

 
Lars Sørensen
Reply

They will not prevent you from adding QS parameters, but they will help you avoid hardcoding the parameters, and thus, you'll be able to control e.g. A4/Letter, margin, landscape/portrait etc. on individual websites in website settings.

Br.

Lars

 

 

 

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Ah, yes, I see. But I was referring to adding the query string parameters in the first place. But I see your point.

 

Cheers,

 

Imar

 

 
Lars Sørensen
Reply

Ah, ok. Don't have a smart answer to that, which doesn't include Nicloai doing some hard work;-)

Br.

Lars

 

 

 

You must be logged in to post in the forum