Failure on Save

The PDF Creator enables you to create secure PDF documents and to view, print and process existing PDF documents.
If you have any questions about the installation and usage of the PDF Creator please post them here.
Post Reply
WWalden
Posts: 5
Joined: Thu Nov 13 2003

Failure on Save

Post by WWalden »

I am evaluating the demo version of the Creator / Converter.

I have a need to create 4 PDF files from different MS Office documents, and append them together into one final document. All of this is happening server side using a .NET Web Service (in C#).

I am able to create my 4 PDF files, and the code to append them together executes with no errors, but when I try to Save the resulting document, it fails with a non-descriptive error message. I can't tell what's happening.

Is there a time limit on functionality in the demos that could be causing this? Also, the documents are not all the same orientation (Landscape / Portrait). Could this be the issue?

Below I have pasted the code I am using to append the documents together. Thanks.

Code: Select all


// Init the PDFCreator 
PDFCreator.PDFCreactiveXClass pdfGen = new PDFCreator.PDFCreactiveXClass();

// Open the first file (pathList is an array of paths to the 4 files)
pdfGen.Open(pathList[0], "");
		
// Now append the rest
for(int pathIndex = 1; pathIndex < pathList.Length; pathIndex++) {
     string nextPath = pathList[pathIndex];
     pdfGen.Append(nextPath,"");
}

// Create a temp path to save to
string destPath = this._tempDir + "\\" + this._random.Next(10000).ToString() + ".pdf";

// Now Save (---- FAILS HERE----)
pdfGen.Save(destPath, PDFCreator.FileSaveOptionConstants.acFileSaveView);


Joan
Amyuni Team
Posts: 2799
Joined: Wed Sep 11 2002
Contact:

Post by Joan »

Hello,

When did you download the demo versions? Our latest version of the demos is posted online two days ago, please feel free to download it.

I am not sure why you are using the PDF Creator to append the pdf files, you can do this using the Document interface of CDintf you received with the PDF Converter.

Finally please note that the file should be closed so you can save to it, if it opened while saving you will get an error.

If you are still facing problems with the new version please send your sample code to support@amyuni.com

Thanks.
WWalden
Posts: 5
Joined: Thu Nov 13 2003

Post by WWalden »

I will try out your suggestions and let you know how it works out. Thanks!
WWalden
Posts: 5
Joined: Thu Nov 13 2003

Post by WWalden »

I downloaded the new version, and changed my code to use the Common Driver Interface, but it still fails on calling 'Save'.

Here is the new code:

Code: Select all


CDIntfEx.Document pdfGen = new CDIntfEx.DocumentClass();

// Open the first document
pdfGen.Open(pathList[0]);
			
// Now append the rest
for(int pathIndex = 0; pathIndex < pathList.Length; pathIndex++) {
     string nextPath = pathList[pathIndex];
     pdfGen.Append(nextPath);
}

// Create a new path to save the resulting document to.
string destPath = this._tempDir + "\\" + this._random.Next(10000).ToString() + ".pdf";

// Save ------ FAILS HERE -------
pdfGen.Save(destPath);

As before, pathList is an array of strings containing file paths to already existant PDF files. I am attempting to save the results to a new path, so it should be able to Save with no problems I would think.

What am I doing wrong? Thanks.
Joan
Amyuni Team
Posts: 2799
Joined: Wed Sep 11 2002
Contact:

Post by Joan »

Hello,

Please try to use constant path like "c:\temp\test.pdf" instead of relative path, this may help.

If not, please send us the file you are trying to save along with your code to support@amyuni.com

Thanks.
Post Reply