We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Adding barcode to PDF

Thread ID:

Created:

Updated:

Platform:

Replies:

120660 Oct 1,2015 08:45 AM UTC Oct 2,2015 01:20 PM UTC Xamarin.Forms 1
loading
Tags: PDF
Nicola Loro
Asked On October 1, 2015 08:45 AM UTC

Hi.

First of all, thanks to anyone who can help. I'm not able to find documentation on how to dynamically add a barcode to a PDF generated by Syncfusion libraries for Xamarin.Forms PCL.
I'm both able to generate the barcode and to display on the screen, and I'm able to build a pdf, adding dynamic text and images. But no way to include the dynamic barcode into the PDF at runtime.

Again thanks for any help.

Nicola

Abirami Selvan [Syncfusion]
Replied On October 2, 2015 01:20 PM UTC

Hi Nicola,

 

Thank you for contacting  Syncfusion support.

 

We have the support to draw the barcode in PDF at runtime in xamarin platform.

Please refer the below code snippet :

//Create the PDF document

PdfDocument document = new PdfDocument();

//Creates a new page

PdfPage page = document.Pages.Add();

//Create font and font style.

PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 12f, PdfFontStyle.Bold);

//Creates a new PdfCode128BBarcode.

PdfCode128BBarcode code128B = new PdfCode128BBarcode();

//Set the font to code128B.

code128B.Font = font;

//Set the barcode text.

code128B.Text = "CODE128B";

//Draw a barcode in the new Page.

code128B.Draw(page, new PointF(25, 500));

//save and close the document

MemoryStream stream = new MemoryStream();

document.Save(stream);

document.Close();

 

Xamarin.Forms.DependencyService.Get<ISave>().Save("Barcode.pdf", "application/pdf", stream);

 

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

 

Regards,

Abirami.


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;