How to generate a Landscape PDF

dbasi
Tera Contributor
I have a requirement with my client to develop a custom PDF, processing data derived from a catalog request. However, I am having trouble setting the PDF to landscape. I've utilised the GeneralFormAPI script includes and there's even a reference to setting landscape. However, it calls the GeneralPDF script includes setting the Landscape variable to null.
find_real_file.png
 
Does anyone know of a method to set the page to Landscape?
9 REPLIES 9

Anil Shewale
Mega Guru

Hi dbasi

check in  following thread post of shubh1992 .

https://community.servicenow.com/community?id=community_question&sys_id=a6c58721db1cdbc01dcaf3231f96...

 

If it help mark helpful or correct 

Thanks and regards

Anil

michaelj_sherid
ServiceNow Employee
ServiceNow Employee

Hi @dbasi You have to do this at the PDF document level (the one that you upload into ServiceNow to create the Template. Changing the orientation is not supported when the PDF is generated but you can create the Adobe document in Landscape, and this will work. It will be presented and printed in landscape as well.

 Here is the example of the OOB NDA example printed out:

 

find_real_file.png

Regards,

Mike

MrMuhammad
Giga Sage

Hi @dbasi

Did you try passing the true as the parameter to GeneralPDF.document method.

like this replace null with true and try. 

var pdfDoc = new GeneralPDF.Document(true, null, null, null, pageSize, headerImage);

also in the GeneralPDF.Document function, change this.landscape= false to

this.landscape = true;

As per the method documentation it should help you generate PDF in landscape mode. 

 

Let me know if it works and please mark my response as CORRECT & HELPFUL if it answered your question. 

 

Thanks & Regards,

Sharjeel

Regards,
Muhammad

dbasi
Tera Contributor

@Muhammad I've tested this and there is no change to the orientation.