Page 1 of 1

Cannot Create File Error

Posted: Tue Mar 27, 2012 8:27 pm
by rgoodson40
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

Re: Cannot Create File Error

Posted: Wed Mar 28, 2012 9:49 am
by SamiKharma
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

Re: Cannot Create File Error

Posted: Wed Mar 28, 2012 4:20 pm
by rgoodson40
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

Re: Cannot Create File Error

Posted: Wed Mar 28, 2012 4:45 pm
by Loïc
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