Q&A - Question

Print PaperSize

Question
EltS asked on June 01, 2018, keyword: Developer Kernel
Hi,

In ASP .NET, how could I choose the papersize, like printing using A4 or A3. 

The command bellow is used to print:

GIS.PrintPdf(@"c:\layout.tpl", "Print");
Answers
EltS replied April 16, 2018
Hi,

The only way that I found is changing the printtemplate.tpl file:

[TatukGIS PrintTemplate]
; PAGESIZE can be set only on PDF device
  PAGESIZE=297.00mm,210.00mm

I've changed the PAGESIZE to alternate the layout (landscape/ portrait). However, when I try to change the PAGESIZE to print other pagesize, like A3 (297.00 mm; 420.00 mm), I got an error message:

Error: Sys.WebForms.PageRequestManagerServerErrorException: Generic error GDI+

Is it correct to change the paper size in TPL file? Is there other way to change the paper size and paper orientation?
Danv replied June 01, 2018
I do not whether you use the Editor (maybe as admin tool for ASP.NET) but if you have the Editor, does it work in the Editor this A3 template?

I have just tested it in our ASP.NET application and it works.
Our code is still as from a sample from TatukGIS but it works.

PdfUrl = "<div><A HREF='" + GIS.PrintPDF(Page.MapPath("~/vb/printtemplate_A3.tpl"), "Rendering of district|TatukGIS Developer Kernel for ASP.NET") + "' target='new'>View PDF</A></div>"   

This is the template content of our TPL file:

; '*' means the calculations are performed relative to margins of a print area
; Without '*' calculations will be done relative to the page border.
; For PDF output margins are always equal to the page size.

[TatukGIS PrintTemplate]
; PAGESIZE can be set only on PDF device
;  PAGESIZE=297.00mm,210.00mm
  PAGESIZE=420.00mm,297.00mm

; place graphic and text at the top
;  GRAPHIC1= *1.00cm, *0.75cm, *5.00cm, *2.25cm,"logo_outline.WMF"

; place text at the top
  TEXT1=    *5.00cm, *0.75cm,*-0.75cm, *3.00cm,RIGHTJUSTIFY,NAVY,,38,BOLD:ITALIC

; place text at the top
  TEXT2=    *0.75cm,*-0.50cm,*-0.75cm,*-0.02cm,RIGHTJUSTIFY,BLACK,,8

; draw backround border for the map & the map itself
  BOX1=     *0.75cm, *3.00cm,*-6.75cm,*-0.75cm,Blue
  BOX2=     *0.85cm, *3.10cm,*-6.85cm,*-0.85cm,Yellow
  MAP1=     *1.00cm, *3.25cm,*-7.00cm,*-1.00cm


; draw background border for the legend & the legend itself
  BOX3=    *-6.50cm, *3.00cm,*-0.75cm,*-0.75cm,Blue
  BOX4=    *-6.40cm, *3.10cm,*-0.85cm,*-0.85cm,Yellow
  ;white background because legend is transparent by default
  BOX5=    *-6.25cm, *3.25cm,*-1.00cm,*-1.00cm,White
  LEGEND1= *-6.15cm, *3.30cm,*-1.00cm,*-1.00cm

; draw thin line around the map
  FRAME1=   *0.01cm, *0.01cm,*-0.01cm,*-0.01cm,BLACK,0.01mm

Maybe you got another problem in the template???


 
EltS replied June 01, 2018
HI,

Yeah, It was another problem in our template. A sintaxe error, actually.

Thank you.
If you would like to answer the question please Sign In.
*
*
Please review our recent Privacy Policy.
If you have any questions or requests, please contact us.
Rules
The Questions and Answers (Q & A) is intended to provide a means of communication between TatukGIS customers.
 
  1. Licensed users (with active maintenance play) of TatukGIS products may contribute to the Q & A content. Read-only access is available to anyone.
  2. Keep the content positive and professional.
  3. Be courteous to others by posting information when a question or issue asked on the Q & A is answered or resolved by other means (such as with help from TatukGIS technical support). Offer others at least a hint how the posted question was answered or the issue was resolved.
  4. The Q & A is not a replacement for TatukGIS technical support. TatukGIS team may or may not regularly follow or contribute content.