« Formatting and error … | Home | Our JavaScript engine… »

TraceFile option in MBS Xojo DynaPDF Plugin

If you are looking to debug a problem with your Xojo code using MBS Xojo DynaPDF Plugin, we can help with our trace feature.

Dim pdf As New MyDynapdfMBS
pdf.TraceFile = SpecialFolder.Desktop.Child("dynapdf.txt")

Once you put the TraceFile assignment there, the plugin will open the file and start writing log messages until the PDF is object is done. The output may look like this:

SetLicenseKey
CreateNewPDFWfile
    file: /Users/cs/Desktop/Create PDF.pdf
    Result: true
SetDocInfoW
    DInfo: 4
    Text: "My first Xojo output"
    Result: true
SetPageCoords
    value: 1
    Result: true
Append
ClearPageGraphics
    Result: true
SetFontW
    Name: "Times"
    Style: 1
    Size: 40.000000
    Embed: true
    CP: 39
    Result: 0
WriteFTextW
    Align: 1
    Text: "My first Xojo output!"
    Result: true
EndPage
ClearPageGraphics
    Result: true
CloseFile
ClearPageGraphics
MyInitProgressProc
    ProgType: 1
    MaxCount: 1
MyProgressProc
    ActivePage: 1
    Result: 0
MyProgressProc
    ActivePage: 1
    Result: 0
    Result: true
PDFDestructor

Now you see more than you may be calling directly. You see the file path used for creating the PDF with CreateNewPDF function. Then we call SetDocInfo to set the subject field for the PDF. We set page coordinate system and append a page, which implicitly clears page graphics. Next we set a font and write something and you see all the details like the code page 39, which is unicode. We close the page, which clears page graphics again in case you used it. We close the file and save it, which invokes optionally the progress events until the destructor runs finally and ends the trace file.

If you build a complex PDF and you call thousands of DynaPDF functions, this log may help you to find the errors by looking for error messages or result codes here.
06 12 19 - 08:54