How to set the page height following the contnent at runtime ?

Hello Syncfusion's team,

1) I want use PDF and PdfViewer to generate tickets for POS (point of sale). The size of ticket is W=80mm (static) and H=dynamic value fixed at runtime (depending of contnent). Can you help me to do this?

2) How to print a pdf document on bluetooth thermal printer ? 

Best regards


3 Replies

IJ Irfana Jaffer Sadhik Syncfusion Team April 22, 2022 01:41 PM UTC

Hi Cosyspro,


I want use PDF and PdfViewer to generate tickets for POS (point of sale). The size of ticket is W=80mm (static) and H=dynamic value fixed at runtime (depending of contnent). Can you help me to do this?

We have attached the sample to demonstrate how to set height of a pdf document in runtime with the output document for your reference, please try the sample on your end and let us know if it satisfies your requirement.

Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/Sample-435786818

Output: https://www.syncfusion.com/downloads/support/directtrac/general/pd/Output-1550680153

Please let us know if you need any further assistance in this.

How to print a pdf document on bluetooth thermal printer

Please refer the following UG documentation to print a pdf document:

https://help.syncfusion.com/xamarin/pdf-viewer/printing-pdf-files

Please let us know if you need any further assistance in this.


Regards,

Irfana J.



CO Cosyspro replied to Irfana Jaffer Sadhik May 1, 2022 03:23 AM UTC

Hello Irfana J,

Thank you for your response.

For the first question, Your example works. But, when I add another contnent (sub grid to sum the total mount and the mount in letters), it does not work !

My Questions:

1) When I must use the following instructions : At the end of the document generation or after each insertion of element ?

            //Bind event to calculate page height

            if (isLayout)

                element.BeginPageLayout += BeginPageLayout;

            element.Draw(result.Page, new Syncfusion.Drawing.PointF(0, result.Bounds.Bottom + 5));

            //Calculate actual height of the client area in single page PDF

            if (isLayout && (documentTicket.Pages.Count > 1))

                pageHeight += (result.Bounds.Height - page.Graphics.ClientSize.Height);

2) Can you modify your example and add to it another grid and text element to show me how to do ?

Regards



IJ Irfana Jaffer Sadhik Syncfusion Team May 2, 2022 12:37 PM UTC

Hi Cosyspro,


We have attached the sample to demonstrate how to add multiple tables sequentially in a PDF using PdfGridLayoutResult with the output document for your reference, please try the sample on your end and let us know if it satisfies your requirement.

Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/Sample_(2)1322640613

Output: https://www.syncfusion.com/downloads/support/directtrac/general/pd/output_(2)781876627


Please refer to the below link for more information,

KB: https://www.syncfusion.com/kb/9742/how-to-add-multiple-tables-sequentially-in-a-pdf-using-c-and-vb-net

UG: https://help.syncfusion.com/file-formats/pdf/working-with-tables#adding-multiple-tables

Please let us know if you need any assistance in this.


Regards,

Irfana J.



Loader.
Up arrow icon