|
I have read all the scripts from the Debenu Quick PDF Library 9.13 Demo (2.70) application and successfully converted the sample code taken from to VS2008 Visual C++ non-mfc MBCS ( non-unicode hence use xxxxA functions), using dynamic DLL linking method :[Scripts Tab]->[Document Management]->Create PDF-A Document. It works and open perfectly (CreateTable,etcs) in Adobe Reader without error ! Now, back to my previous problem with CreateTable function. I deleted the unnecessary codes, only left with the CreateTable related codes. Error 110 encounters again ! I try to figure out what is the problem. The only difference is NewPage is called from the working first sample code. Once I add in the NewPage function, it works and open perfectly again ! However, there will be 2 pages, page 1 empty and the table will appear in page 2 ! Is this a bug ? Please advise. Thanks in advance ! Best regards Dragon Below is my source code : void CreatePDFTable(void) { int result; // CreateLibrary InstanceID=pDPLCreateLibrary(); if (!InstanceID) return; // Unlock library result=pDPLUnlockKey(InstanceID,"xxxxxxxxxxxxxxx"); if (!result) return; result = pDPLSetPDFAMode(InstanceID, 2); result = pDPLSetOrigin(InstanceID, 1); if (!result) return; // Now lets add a bunch of different objects to the PDF which // are supported by the PDF/A specification. // Add some document properties to the PDF result=pDPLSetInformation(InstanceID,0, "1.9"); result=pDPLSetInformation(InstanceID,1, "John Smith"); result=pDPLSetInformation(InstanceID,2, "The Life and Times of John Smith"); result=pDPLSetInformation(InstanceID,3, "A very special book"); result=pDPLSetInformation(InstanceID,4, "book, paperback, ebook"); result=pDPLSetInformation(InstanceID,5, "Mother Earth"); result=pDPLSetInformation(InstanceID,6, "Humanity"); // Add some custom information to the PDF result=pDPLSetCustomInformation(InstanceID,"FirstName", "John"); result=pDPLSetCustomInformation(InstanceID,"LastName", "Smith"); result=pDPLSetCustomInformation(InstanceID,"Coolness Level", "Very Cool"); // ********* Without This Function, Error 110 occurs ! ******** // result=pDPLNewPage(InstanceID); // ^^^^^^^ Without This Function, Error 110 occurs ! ^^^^^^^// // Create a table and draw it on a PDF int fontID2 = pDPLAddTrueTypeFont(InstanceID,"Stencil Std [Bold]", 1); result=pDPLSetHTMLBoldFont(InstanceID,"Default", fontID2); int fontID3 = pDPLAddTrueTypeFont(InstanceID,"Palatino Linotype [Italic]", 1); result=pDPLSetHTMLItalicFont(InstanceID,"Default", fontID3); int fontID4 = pDPLAddTrueTypeFont(InstanceID,"Lucida Fax", 1); result=pDPLSetHTMLNormalFont(InstanceID,"Default", fontID4); tableID = pDPLCreateTable(InstanceID, 5, 5); // Specify color and width of borders result = pDPLSetTableBorderColor(InstanceID, tableID, 0, 0.3, 0.204, 0); result = pDPLSetTableBorderWidth(InstanceID, tableID, 0, 0.2); // Specify table row height and table column width result = pDPLSetTableRowHeight(InstanceID, tableID, 1, 5, 0); result = pDPLSetTableColumnWidth(InstanceID, tableID, 1, 5, 100); result = pDPLSetTableCellBackgroundColor(InstanceID, tableID, 1, 1, 1, 5, 0.3, 0.7, 1.0); result = pDPLSetTableCellAlignment(InstanceID, tableID, 1, 1, 1, 5, 4); // Setup the column headers and content for the first row result = pDPLSetTableCellContent(InstanceID, tableID, 1, 1, "<b>This Week</b>"); result = pDPLSetTableCellContent(InstanceID, tableID, 1, 2, "<b>Last Week</b>"); result = pDPLSetTableCellContent(InstanceID, tableID, 1, 3, "<b>Artist Name</b>"); result = pDPLSetTableCellContent(InstanceID, tableID, 1, 4, "<b>Peak</b>"); result = pDPLSetTableCellContent(InstanceID, tableID, 1, 5, "<b>Weeks On</b>"); result = pDPLSetTableCellContent(InstanceID, tableID, 2, 1, "1"); result = pDPLSetTableCellContent(InstanceID, tableID, 2, 2, "1"); result = pDPLSetTableCellContent(InstanceID, tableID, 2, 3, "<b>The Black Eyed Peas</b><br>Boom Boom Pow"); result = pDPLSetTableCellContent(InstanceID, tableID, 2, 4, "<b>1</b>"); result = pDPLSetTableCellContent(InstanceID, tableID, 2, 5, "<b>11</b>"); // Insert the content for the third row result = pDPLSetTableCellContent(InstanceID, tableID, 3, 1, "2"); result = pDPLSetTableCellContent(InstanceID, tableID, 3, 2, "3"); result = pDPLSetTableCellContent(InstanceID, tableID, 3, 3, "<b>Missy Higgins</b><br>Life is a rainbow"); result = pDPLSetTableCellContent(InstanceID, tableID, 3, 4, "<b>2</b>"); result = pDPLSetTableCellContent(InstanceID, tableID, 3, 5, "<b>8</b>"); // Insert the content for the fourth row result = pDPLSetTableCellContent(InstanceID, tableID, 4, 1, "3"); result = pDPLSetTableCellContent(InstanceID, tableID, 4, 2, "2"); result = pDPLSetTableCellContent(InstanceID, tableID, 4, 3, "<b>Silverchair</b><br>The Door"); result = pDPLSetTableCellContent(InstanceID, tableID, 4, 4, "<b>3</b>"); result = pDPLSetTableCellContent(InstanceID, tableID, 4, 5, "<b>7</b>"); // Insert the content for the fourth row result = pDPLSetTableCellContent(InstanceID, tableID, 5, 1, "4"); result = pDPLSetTableCellContent(InstanceID, tableID, 5, 2, "4"); result = pDPLSetTableCellContent(InstanceID, tableID, 5, 3, "<b>Rolling Stones</b><br>Sweet Virginia"); result = pDPLSetTableCellContent(InstanceID, tableID, 5, 4, "<b>4</b>"); result = pDPLSetTableCellContent(InstanceID, tableID, 5, 5, "<b>19</b>"); result = pDPLDrawTableRows(InstanceID, tableID, 50, 50, 400, 1, 0); result=pDPLSaveToFile(InstanceID,"HelloFromDLL.pdf"); if (!result) return; // Release Library result = pDPLReleaseLibrary(InstanceID); if (!result) return; }
|