PDF Draw a text

Discussions about PDF management.
Post Reply
maxvalt
Posts: 19
Joined: Thu Dec 08, 2011 3:52 pm

PDF Draw a text

Post by maxvalt » Mon Nov 16, 2015 7:15 pm

Hi,
I can't to draw a text in a PDF if this PDF has a font integrated.
This PDF is generated from a Panasonic scanner.
If I convert a PDF in TIFF and after TIFF to PDF, the font is not present and I can to draw a text...

I hope that you understand me.
Bye
Massimo

I have 8.5 release...

delbeke
Posts: 89
Joined: Wed Oct 31, 2012 5:07 pm

Re: PDF Draw a text

Post by delbeke » Tue Nov 17, 2015 3:40 pm

Hi Maxvalt

I do not understand why you say : I can't to draw a text in a PDF if this PDF has a font integrated

GdPicture can add text to any PDF.

Look at the sample for the AddTrueTypeFont Method

https://www.gdpicture.com/guides/gdpicture/web ... eFont.html

Jean-Luc

maxvalt
Posts: 19
Joined: Thu Dec 08, 2011 3:52 pm

Re: PDF Draw a text

Post by maxvalt » Tue Nov 17, 2015 3:56 pm

Hi Jean
I used the example code and I have this error : This pdf does not have a first page
but it has 15 pages... I check with MessageBox.Show(oGdPicturePDF.GetPageCount)
do you have any ides ?
Thanks in advance.

delbeke
Posts: 89
Joined: Wed Oct 31, 2012 5:07 pm

Re: PDF Draw a text

Post by delbeke » Tue Nov 17, 2015 7:03 pm

Hi Maxvalt.

Can you attach the pdf ?

Jean-Luc

maxvalt
Posts: 19
Joined: Thu Dec 08, 2011 3:52 pm

Re: PDF Draw a text

Post by maxvalt » Thu Nov 19, 2015 10:33 am

Hi Jean
In attach a PDF example zipped and the code that I use.
Thanks in advance.
M

Code: Select all

        Dim oGdPicturePDF As New GdPicturePDF
        Dim status As GdPictureStatus = oGdPicturePDF.LoadFromFile("D:\Test\2.pdf", False)
        If status = GdPictureStatus.OK Then

            MessageBox.Show(oGdPicturePDF.GetPageCount)    ' 18 pages....

            status = oGdPicturePDF.SelectPage(1)   ' in error....
            If status = GdPictureStatus.OK Then
                Dim FontResName As String = oGdPicturePDF.AddTrueTypeFont("Times new Roman", False, False, False)
                If FontResName = "" Then
                    MessageBox.Show("Unknown truetype system font")
                Else
                    oGdPicturePDF.SetMeasurementUnit(PdfMeasurementUnit.PdfMeasurementUnitMillimeter)
                    oGdPicturePDF.SetOrigin(PdfOrigin.PdfOriginTopLeft)
                    oGdPicturePDF.SetTextSize(30)
                    status = oGdPicturePDF.DrawText(FontResName, 10, 10, "Here is some text")
                    If status = GdPictureStatus.OK Then
                        oGdPicturePDF.SaveToFile("test_AddTrueTypeFont_func.pdf", False)
                        MessageBox.Show("Ok")
                    Else
                        MessageBox.Show("DrawText function failed")
                    End If
                End If
            Else
                MessageBox.Show("This pdf does not have a first page", "Error")
            End If
        Else
            MessageBox.Show("The file can't be opened")
        End If
Attachments
2.zip
(146.79 KiB) Downloaded 292 times

delbeke
Posts: 89
Joined: Wed Oct 31, 2012 5:07 pm

Re: PDF Draw a text

Post by delbeke » Fri Nov 20, 2015 11:24 am

Hi Maxvalt.

I run your code as is and i can not reproduce your error.
I have attached the resulting file.

Makes sure you are using our last release version 11.2.21 at ww.gdpicture.com/download-gdpicture/

Jean-Luc
Attachments
test_AddTrueTypeFont_func.zip
(146.96 KiB) Downloaded 344 times

maxvalt
Posts: 19
Joined: Thu Dec 08, 2011 3:52 pm

Re: PDF Draw a text

Post by maxvalt » Fri Nov 20, 2015 11:38 am

Hi Jean
but I have not the last release....I have 8.5 ...
Do you know if exist a path o major release of 8.5 ?

Thanks.
M

delbeke
Posts: 89
Joined: Wed Oct 31, 2012 5:07 pm

Re: PDF Draw a text

Post by delbeke » Fri Nov 20, 2015 5:10 pm

Hi Maxvalt

These version is no longer maintained for several years.

All i can say is to upgrade to our lastest version.

Jean-Luc.

maxvalt
Posts: 19
Joined: Thu Dec 08, 2011 3:52 pm

Re: PDF Draw a text

Post by maxvalt » Fri Nov 20, 2015 6:07 pm

Thanks Jean
Bye
M

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest