DrawToWeb

Skip Navigation LinksHome  /  Support  /  Forums  /  DynamicPDF Merger for .NET (v4)  /  DrawToWeb

DynamicPDF Merger for .NET (v4) Forum

 Feb 11 2008 12:31 PM
Hi,
  I am using dynamic pdf merger v 4.0 to merge existing pdf documents that I have.  I am using the following code:

I am using treeview control to display files. 

MergeDocument document = new MergeDocument();
document.Append(node.value); 

document.DrawToWeb("Output.pdf",true);

When I run this code , it opens up a dialog and asks if I want to open or save Output.pdf.  when open the file it is giving error
"adobe reader could not open output.pdf  because it is either not supported file type or because the file name has been damaged (for example, it was sent as an email attachment and wasn't correctly decoded)"

I am able to open development server without any problem. But when I deploy to production, and try to open, I am getting this error.
I am getting this problem with save also.
I didn't get this problem v3.0

please suggest me on this one.


 Feb 11 2008 1:25 PM
Posted by a ceTe Software moderator
Hello,

The error you are getting is most probably because of some stray HTML getting outputted along with the PDF stream. Different Editions of Acrobat behaves differently with this stray HTML. Please try adding the following line of code right after the DrawToWeb method of the document object and it will likely solve your problem.

    document.DrawToWeb("Output.pdf",true);
    Visible = false;

Thanks,
ceTe Software Support Team
 Feb 11 2008 2:40 PM
Hi,
Still I am getting the same problem.

 Feb 11 2008 3:13 PM
Posted by a ceTe Software moderator
Hello,

We think the problem could be related to the headers not getting set correctly. We will need to take a look at the headers from the page calling the PDF document. We recommend using ieHTTPHeaders tool which allows you to capture all IE headers. Run your example once again and send us the headers it returns. It's free to download. Following is the link: ieHTTPHeaders.

Thanks,
ceTe Software Support Team
 Mar 25 2008 7:30 AM
Hi guys,

I am getting the exact same error. Any news on this matter?
 Mar 25 2008 7:37 AM
For clarity:

Document document = new Document();
ceTe.DynamicPDF.Page page = new ceTe.DynamicPDF.Page();
page.Elements.Add(new Label("Hello World!", 0, 0, 100, 12, Font.Helvetica, 12));
document.Pages.Add(page);
document.DrawToWeb("Test.pdf");

This fails to create a valid pdf document.

document.Draw(@"c:\test.pdf") does work however.

Regards,
Jim
 Mar 25 2008 7:46 AM
Posted by a ceTe Software moderator
Hello Jim,

The reason for this error you are getting is most probably because of some stray HTML getting outputted along with the PDF stream. Please try adding the following line right after the DrawToWeb method of the document.

   Visible = false;

If you are still getting this error then we will need to look at the http headers returned by the page calling the PDF. We recommend using ieHTTPHeaders tool which allows you to capture all IE headers. Run your example once again and send us the headers it returns. Following is the link: ieHTTPHeaders.

Thanks,
ceTe Software Support Team.
 Mar 25 2008 8:13 AM
Hi,

This does seem te work! Great!

I will experiment further with the PDF generation.

Regards,
Jim
 Mar 25 2008 8:19 AM
P.S. Are you working on a solution in stead of a work around?

Setting visible to false is not something I prefer, since I would like to show the report on my webpage as well.

Regards,
Jim
 Mar 25 2008 8:20 AM
P.S. Are you working on a solution in stead of a work around?

Setting visible to false is not something I prefer, since I would like to show the report on my webpage as well.

Regards,
Jim
 Mar 25 2008 9:53 AM
Posted by a ceTe Software moderator
Hello Jim,

The stray HTML on your page that gets added to the content stream will cause this error. There is nothing in our product causing this. In order to stop this stray HTML from getting added, you will have to use the Visible = false; line after the DrawToWeb method.

Thanks,
ceTe Software Support Team.
 Mar 25 2008 11:25 AM
I noticed this when I didn't set the visible property to false. I now fully understand the problem and I have found a way to avoid it. My customers can now select whether they want the report on screen, in a file or as a PDF. It works great.

Thanx for your quick replies!
Jim

All times are US Eastern Standard time. The time now is 10:32 PM.