Cannot Create File Error

Discussions about PDF management.
Post Reply
rgoodson40
Posts: 32
Joined: Sun Jan 30, 2011 8:40 pm

Cannot Create File Error

Post by rgoodson40 » Tue Mar 27, 2012 8:27 pm

Hello,

When I try to save the changes to a pdf file using the method GdViewer1.SaveDocumentToPDF, I get the error "Cannot Create File" (41). I am trying to save on top of the currently displayed file.

For example, I am displaying the file "c:\temp.pdf" using the method "MyGdPicturePDF.LoadFromFile("c:\temp.pdf", False) and then saving it back using the method GdViewer1.SaveDocumentToPDF(("c:\temp.pdf"). This works fine for TIFF and JPEG files, but not for pdf's.

Any idea how I can save the changes to a pdf file?

Thanks,
Reagan

SamiKharma
Posts: 352
Joined: Tue Sep 27, 2011 11:47 am

Re: Cannot Create File Error

Post by SamiKharma » Wed Mar 28, 2012 9:49 am

Hi,

You cannot append an existing pdf file that way. The method you are using is just for saving to a new pdf.

If you want to append an existing pdf file, you need to purchase the managed pdf plugin.

Best Regards,
Sami

rgoodson40
Posts: 32
Joined: Sun Jan 30, 2011 8:40 pm

Re: Cannot Create File Error

Post by rgoodson40 » Wed Mar 28, 2012 4:20 pm

Thank you for the reply. What I am trying to do is save a rotated pdf file that is being displayed within the GdViewer control so that the changes get reflected the next time that document gets displayed within the viewer. The only way I know to do that is to call SaveDocumentToPDF, which is returning the above error. Is there a better way to do this?

Currently I am using the free trial while I am building GdPicture into my application. I want to make sure it will work correctly before I buy it. I am just about finished with all of the functionality and I will be purchasing the ultimate package in the next couple of days, depending on when I finish.

Thanks,
Reagan

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: Cannot Create File Error

Post by Loïc » Wed Mar 28, 2012 4:45 pm

Reagan the best way is:

- Load the PDF document by using a GdPicturePDF object. Set true to the LoadInMemory parameter.
- Display your PDF on the GdViewer by using the DisplayFromGdPicturePDF() method
- Apply your changes to the PDF, if any
- Save it back by using the SaveToFileInc() method of the GdPicturePDF class. By this way you will be able to overwrite the original document.

The demo "PagesManipulation" provided in C# and VB.NET demonstrate this kind of scenario.

Hope this helps!

Kind regards,

Loïc

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests