Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Tue Dec 10, 2019 11:52 am

In an VB.NET project i'm creating a pdf document using spire.PDF 5.11.9.18046

The whole process of creating the object:

Code: Select all
 Using Dokument As New PdfDocument


adding one or more pages:

Code: Select all
            'Seiten hinzufügen         
            '   1. Seite
            Dim Seiten As PdfPageBase = Dokument.Pages.Add(PdfPageSize.A4, SeitenRand, SeitenAusr, SeitenOri)
            '   Wenn nötig weitere Seiten
            If SeiteAnz > 1 Then
                For SeitenID = 1 To SeiteAnz - 1
                    Seiten.Document.Pages.Add(PdfPageSize.A4, SeitenRand, SeitenAusr, SeitenOri)
                Next SeitenID
            End If


adding the content:

Code: Select all
 ' Logo
                Seiten.Document.Pages.Item(SeitenID).Canvas.DrawImage(Logo, RandLi, RandOb)

                ' Firmenname, Tel.Nr, Webseite, E-Mail Rechts im Briefkopf
                Seiten.Document.Pages.Item(SeitenID).Canvas.DrawString(KopfText, HESchriftNormal, Textfarbe, HTab, RandOb)
....


printing it:

Code: Select all
    If Copies > 0 Then
                Dokument.PrintSettings.Copies = Copies
                Dokument.PrintSettings.PrinterName = My.Settings.DruckerA4mono
                Dokument.PrintSettings.Collate = False
                Dokument.PrintSettings.DocumentName = Me.Text
                Dokument.PrintSettings.Duplex = Dokument.PrintSettings.CanDuplex
                Dokument.PrintSettings.PrinterResolutionKind = Print.PdfPrinterResolutionKind.Medium

            End If

            Dokument.Print()


and finally disposing the object.

Code: Select all
  End Using


is taking place in only one sub of some 100 lines

It's working perfectly the first and second time the code ist processed. Starting from the third time several characters are missing. Each time the code is processed more characters are missing. In the attachment you can see "5" and "y" are missing. (tried to attach pdf but that isn't allowed. Anyway the only thing one could have seen there is that y and 5 where missing all over the text.)

This is only happening when the document is printed.

If i save it to a temporary file, and open it afterwards, everything is correct.

Code: Select all
 Dokument.SaveToFile(TempFile)
            Process.Start(TempFile)


Another ting, i observed, that my application uses a lot of memory, when printing, and printing takes a long time.

Normally the app uses ~60 mb of memory. While printing the memory consumption rises up to more than 300 mb. After having printed the first document the memory stays at about 100 mb. So I assume, that something is not "cleaned up" properly.

Well .... I need help

modellflugwelt
 
Posts: 1
Joined: Wed Nov 28, 2018 5:22 pm

Wed Dec 11, 2019 4:04 am

Hi,

Thanks for your inquiry.
About the characters missing issue, since your code is not complete, I changed your code and tested the case with the latest version of Spire.PDF Pack(Hot Fix) Version:5.12.3 but didn't reproduce it. The characters won't miss even print more than three times on my side. About the memory issue while printing, I also cannot reproduce it.

Please try to use the latest version of Spire.PDF Pack(Hot Fix) Version:5.12.3 firstly.

If the issues still exists, to help us investigate them accurately, could you please offer us the following information?
1. A runnable project which could reproduce your issue directly.
2. Your printer information.
3. The OS and Region information, e.g. Win7 64bit, China/Chinese.
4. The RAM information, such as 8GB.

You could upload them here or send us(support@e-iceblue.com) via email.

Best wishes,
Amber
E-iceblue support team
User avatar

Amber.Gu
 
Posts: 525
Joined: Tue Jun 04, 2019 3:16 am

Return to Spire.PDF