Sign UpSign Up   Sign InSign In Welcome Guest,
Live Chat Live Chat

"Invalid pdf format:pdf head signature is not found!" performing a simple merge

Last post 10-21-2007, 11:34 PM by lukeyoyo. 14 replies.
Sort Posts: Previous Next
  •  09-26-2007, 9:31 PM 96344

    "Invalid pdf format:pdf head signature is not found!" performing a simple merge

    Hello --

    I'm having trouble doing a very simple merge.  Is something wrong with the templates or am I doing the technique wrong?  I've attached 2 different templates, both of which yield the same error.

    Here's my code:
            AutoFiller autoFiller = new AutoFiller();

            autoFiller.InputFileName = userDirectory + "\\" + templateFileName;
            autoFiller.OutputStream = Response.OutputStream;

            autoFiller.ImportDataTable(dt);
            autoFiller.Save();

    Where InputFileName = "C:\Documents and Settings\admin\My Documents\Visual Studio 2005\WebSites\MyApp\App_Data\UserTemplates\00550000000wI63AAE\Quote Template.pdf"

    Thanks!
    Mike
     
  •  09-26-2007, 9:31 PM 96345 in reply to 96344

    Re: "Invalid pdf format:pdf head signature is not found!" performing a simple merge

    Attachment: Present (inaccessible)
    Here's the other file...
     
  •  09-27-2007, 6:24 AM 96404 in reply to 96345

    Re: "Invalid pdf format:pdf head signature is not found!" performing a simple merge

    Hi,

    Can you please post your complete project, including the data table structure so that we can more accurately determine the cause of the problem.

    Thanks.

     
  •  09-27-2007, 12:34 PM 96482 in reply to 96404

    Re: Invalid pdf format:pdf head signature is not found! performing a simple merge

    Attachment: Present (inaccessible)
    Hello --

    I have simplified my project to the following chunk of code.
            DataTable testDT = new DataTable();
            testDT.Columns.Add(new DataColumn("CONTACT_LASTNAME", Type.GetType("System.String")));
            DataRow dr = testDT.NewRow();
            dr["CONTACT_LASTNAME"] = "Jones";
            testDT.Rows.Add(dr);


            AutoFiller autoFiller = new AutoFiller();

            autoFiller.InputFileName = "PDF_Form_Test.pdf";
            autoFiller.OutputStream = Response.OutputStream;

            autoFiller.ImportDataTable(testDT);
            autoFiller.Save();

    Even with this simple example, I'm getting the same error.

    I created the PDF Form using Nitro PDF Professional.  Could that be the source of the problem?

    What am I doing wrong?  Thanks!

     
  •  09-27-2007, 8:20 PM 96538 in reply to 96482

    Re: Invalid pdf format:pdf head signature is not found! performing a simple merge

    Hi,

    I have been able to reproduce the error. I have logged this as PDFKITNET-3802. Our developers will try their best to resolve this issue as soon as possible.

    Thanks.

     
  •  10-02-2007, 9:33 PM 97099 in reply to 96538

    Re: Invalid pdf format:pdf head signature is not found! performing a simple merge

    Hi Adeel,

    As long as I'm asking about some other questions, I wanted to check to see how this topic is coming along too.  It concerns me that with such a simple example I ran into problems with PDF.Kit.  Is this product fairly new?  Would you recommend I wait a while before trying to implement it in a production environment?

    All the same, it's an ambitious product and has so much usefulness and value.  I'm greatly looking forward to more progress on this.

    Mike
     
  •  10-03-2007, 8:34 AM 97167 in reply to 97099

    Re: Invalid pdf format:pdf head signature is not found! performing a simple merge

    Dear Mike,

    Sorry for the inconvenience. Our developers are hard at work constantly trying to improve the quality of our products. Some times bugs are present in the component as a result of minor mistakes but still take some time to pin point. I will contact the developer working on this issue and ask him to give you further information about its progress.

    Thanks.

     
  •  10-04-2007, 3:22 AM 97273 in reply to 97167

    Re: Invalid pdf format:pdf head signature is not found! performing a simple merge

    Dear Mike,

    This bug was fixed. A hotfix will be released to solve your problem within the next week.

    Best regards.


    Luke Fu
    Product Developer
    Aspose Changsha Team
    About Us
    Contact Us
     
  •  10-18-2007, 2:56 PM 99250 in reply to 97273

    Re: Invalid pdf format:pdf head signature is not found! performing a simple merge

    Hi Luke --

    It looks like the error message I originally was experiencing has been fixed.  But now a new issue:

    Everything looks like it's going to work, but when I execute the autoFiller.Save() method, Internet Explorer errors ("Internet Explorer cannot display the webpage") and FireFox returns what appears to be a bunch of binary data.

    Here's my code again:

        protected void Button1_Click(object sender, EventArgs e)
        {
            DataTable testDT = new DataTable();
            testDT.Columns.Add(new DataColumn("CONTACT_LASTNAME", Type.GetType("System.String")));
            DataRow dr = testDT.NewRow();
            dr["CONTACT_LASTNAME"] = "Jones";
            testDT.Rows.Add(dr);


            AutoFiller autoFiller = new AutoFiller();

            autoFiller.InputFileName = Server.MapPath("App_Data\\PDF_Form_Test.pdf");
            // autoFiller.OutputFileName = Server.MapPath("App_Data\\output.pdf");
            autoFiller.OutputStream = Response.OutputStream;

            autoFiller.ImportDataTable(testDT);
            autoFiller.Save();
        }

    Am I doing something wrong?  Are the Response headers not getting set properly?

    By the way, the online demo for using autoFiller doesn't appear to work with Firefox, so it might be a related Response headers issue.  (http://www.aspose.com/Products/Aspose.Pdf.kit/Demos/ then choose #9, using FireFox.)

    Many thanks,

    Mike
     
  •  10-18-2007, 7:10 PM 99274 in reply to 99250

    Re: Invalid pdf format:pdf head signature is not found! performing a simple merge

    Hi Mike,
    Sorry for bring you so much troubles.
    As for the new issue, I need your help to locate the bug. Please uncomment the code:
             autoFiller.OutputFileName = Server.MapPath("App_Data\\output.pdf");
    to generate output file on disk, then open it both with Adobe and firefox manully. If everything is ok, please check your browser configuration. An old issue could be of some help: http://www.aspose.com/Community/Forums/thread/68420.aspx. If it does not work, please provide your infor as detail as possible, including browser configure and the full project code.
    Thanks & Best regards.


    Luke Fu
    Product Developer
    Aspose Changsha Team
    About Us
    Contact Us
     
  •  10-18-2007, 9:51 PM 99284 in reply to 99274

    Re: Invalid pdf format:pdf head signature is not found! performing a simple merge

    Hi Luke --

    The other discussion you pointed me to helped a lot.  I have it all working now correctly.  Here's the code I ended up using:

    protected void Button1_Click(object sender, EventArgs e)
        {
            DataTable testDT = new DataTable();
            testDT.Columns.Add(new DataColumn("CONTACT_LASTNAME", Type.GetType("System.String")));
            DataRow dr = testDT.NewRow();
            dr["CONTACT_LASTNAME"] = "Jones";
            testDT.Rows.Add(dr);


            AutoFiller autoFiller = new AutoFiller();

            autoFiller.InputFileName = Server.MapPath("App_Data\\PDF_Form_Test.pdf");
            // autoFiller.OutputFileName = Server.MapPath("App_Data\\output.pdf");

            Response.Expires = 0;
            Response.Buffer = true;
            Response.ClearContent();
            Response.AddHeader("content-disposition", "inline; filename=" + "studentOut.pdf");
            Response.ContentType = "application/pdf";
            autoFiller.OutputStream = Response.OutputStream;
            autoFiller.ImportDataTable(testDT);
            autoFiller.Save();
            Response.End();
        }

    Many thanks.

    Mike
     
  •  10-19-2007, 8:16 AM 99345 in reply to 99284

    Further questions about using autoFiller

    Attachment: Present (inaccessible)
    Hi Luke --

    Now that the autoFiller is working for me, I thought I would make things a little more complicated to see what happens.  In the code below, I have added another row of data (so there are 2 rows now).  I expected that the autoFiller would create a PDF for each row (which it does), however the data from row 1 is repeated on the second page of the PDF.

    Would you take a look at this?  Thanks

    Here is the modified code.... I have attached the output.

       protected void Button1_Click(object sender, EventArgs e)
        {
            DataTable testDT = new DataTable();
            testDT.Columns.Add(new DataColumn("CONTACT_LASTNAME", Type.GetType("System.String")));
            testDT.Columns.Add(new DataColumn("CONTACT_FIRSTNAME", Type.GetType("System.String")));
            DataRow dr = testDT.NewRow();
            dr["CONTACT_LASTNAME"] = "Jones";
            dr["CONTACT_FIRSTNAME"] = "Mike";
            testDT.Rows.Add(dr);
            dr = testDT.NewRow();
            dr["CONTACT_LASTNAME"] = "Smith";
            dr["CONTACT_FIRSTNAME"] = "Sally";
            testDT.Rows.Add(dr);

            AutoFiller autoFiller = new AutoFiller();

            autoFiller.InputFileName = Server.MapPath("App_Data\\PDF_Form_Test.pdf");
            // autoFiller.OutputFileName = Server.MapPath("App_Data\\output.pdf");

            Response.Expires = 0;
            Response.Buffer = true;
            Response.ClearContent();
            Response.AddHeader("content-disposition", "inline; filename=" + "studentOut.pdf");
            Response.ContentType = "application/pdf";
            autoFiller.OutputStream = Response.OutputStream;
            autoFiller.ImportDataTable(testDT);
            autoFiller.Save();
            Response.End();
        }
     
  •  10-20-2007, 9:15 AM 99424 in reply to 99345

    Re: Further questions about using autoFiller

    Dear Mike,

    I'm glad to see that the first experiment has been solved.

    As for your second experiment, I am not very clear about your saying: "the data from row 1 is repeated on the second page of the PDF". In your attachment, "Smith" is on the second page, which is the right result. If you plan to generate two seperated small files, please referring to the following code:

        AutoFiller autoFiller = new AutoFiller(); 
        autoFiller.InputFileName = "App_Data\\PDF_Form_Test.pdf";
        autoFiller.GeneratingPath = "App_Data\\";
        autoFiller.BasicFileName = "output";
        autoFiller.ImportDataTable(testDT );
        autoFiller.Save();

    It will produce two small file, each containing one page, namely output0.pdf and output1.pdf respectively.

    You can also find this in our online API (AutoFiller class, case two). Hope this would help you.

    Best regards.


    Luke Fu
    Product Developer
    Aspose Changsha Team
    About Us
    Contact Us
     
  •  10-20-2007, 10:10 AM 99429 in reply to 99424

    Re: Further questions about using autoFiller

    You must think I'm crazy, but when I open the PDF in my prior message (using Acrobat 8.1 Reader), I see "Jones" on both the first page and the second page.

    That prompted me to open the PDF in Nitro PDF and it looks correct!  Smith shows on the second page!

    This looks more like a problem with Acrobat Reader 8.1, but it is very worrisome.  You may want to view the file in AR 8.1, perhaps something isn't getting set in the PDF to make it fully compatible with it.

    I think I'm in good shape. Thanks again.
     
  •  10-21-2007, 11:34 PM 99480 in reply to 99429

    Re: Further questions about using autoFiller

    Dear Mike,

    I reproduced your problem by installing Adobe Reader 8.1.0. A hotfix is expected to released in one week. BWT, if two seperated small files are outputed, this will not occur any more. Please try and affirm this.

    Best regards.


    Luke Fu
    Product Developer
    Aspose Changsha Team
    About Us
    Contact Us
     
View as RSS news feed in XML