Add Barcode to PDF

Discussions about PDF management.
Post Reply
wnstillman
Posts: 8
Joined: Fri Dec 11, 2009 8:28 pm

Add Barcode to PDF

Post by wnstillman » Thu Sep 22, 2011 5:29 am

We need to add a barcode to an Existing PDF. We added the following snippet of code but do not see the barcode.
Dim oGdPicturePDF As New GdPicturePDF
gdpicturestatus = oGdPicturePDF.DrawBarcode1D(Barcode1DWriterType.Barcode1DWriterCode39, "Test", 10, 10, 250, 80, Color.Black)
the return status code is Generic Error {1}
Can you tell me what we did wrong or give me an example of how to add the barcode?

User avatar
Loïc
Site Admin
Posts: 5576
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: Add Barcode to PDF

Post by Loïc » Thu Sep 22, 2011 11:51 am

Hi,

Here a snippet:

Code: Select all

     
      Dim oGdPicturePDF As New GdPicturePDF
      oGdPicturePDF.LoadFromFile("c:\test.pdf", False)
      oGdPicturePDF.SelectPage(1)
      oGdPicturePDF.SetMeasurementUnit(PdfMeasurementUnit.PdfMeasurementUnitCentimeter)
      oGdPicturePDF.SetOrigin(PdfOrigin.PdfOriginTopLeft)
      oGdPicturePDF.DrawBarcode1D(Barcode1DWriterType.Barcode1DWriterCode128, "0123456789", 1, 1, 5, 1, Color.Red)
      oGdPicturePDF.SaveToFile("c:\test2.pdf")

Let me know if you need further information.

Kind regards,

Loïc

dante23
Posts: 2
Joined: Mon Jul 30, 2012 3:02 am

Re: Add Barcode to PDF

Post by dante23 » Mon Jul 30, 2012 3:07 am

"Dim oGdPicturePDF As New GdPicturePDF
oGdPicturePDF.LoadFromFile("c:\test.pdf", False)
oGdPicturePDF.SelectPage(1)
oGdPicturePDF.SetMeasurementUnit(PdfMeasurementUnit.PdfMeasurementUnitCentimeter)
oGdPicturePDF.SetOrigin(PdfOrigin.PdfOriginTopLeft)
oGdPicturePDF.DrawBarcode1D(Barcode1DWriterType.Barcode1DWriterCode128, "0123456789", 1, 1, 5, 1, Color.Red)
oGdPicturePDF.SaveToFile("c:\test2.pdf")"

why does this code gave me a message on the created file "There was an error opening this document. The file is damaged and could not be repaired."

User avatar
Loïc
Site Admin
Posts: 5576
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: Add Barcode to PDF

Post by Loïc » Mon Jul 30, 2012 9:34 am

Hello,

Your code is working like a charm from my end.

Could you tell us the version of GdPicture you are using and if you've experienced the problem with any pdf document?

Kind regards,

Loïc

dante23
Posts: 2
Joined: Mon Jul 30, 2012 3:02 am

Re: Add Barcode to PDF

Post by dante23 » Tue Jul 31, 2012 2:36 am

Thank you Loic, the codes works fine, my pc just need to be rebooted because I'm using it for almost 1 and a half day.

User avatar
Loïc
Site Admin
Posts: 5576
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: Add Barcode to PDF

Post by Loïc » Tue Jul 31, 2012 8:43 am

ok thank you for the return :)

Gabriela
Posts: 41
Joined: Wed Nov 22, 2017 9:52 am

Re: Add Barcode to PDF

Post by Gabriela » Wed Nov 22, 2017 12:17 pm

Here you can find updated code snippet based on GdPicture.NET 14:

Drawing 1D barcode via mouse on your document
http://guides.gdpicture.com/content/web ... ment.html
Kind regards,

Gabriela
GdPicture Team

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest