Losing layers on PDF files when concatenating

Hi,

One of our applications that uses Aspose.Pdf for .Net combines multiple PDF files of engineering drawings into one multi-sheet PDF. The single sheet PDF files have several layers in them. After they are combined, there are no layers. How can we preserve the layers?
I have tested this with Aspose.Pdf for .Net 6.9.0.

Thanks

Steve

Here is some of the code that does the combine. It basically moves all the file names into an array, sorts them (so the combined sheets will be in order), and then moves them into a stream array. The stream array is then concatenated into one file with the PdfFileEditor Concatenate method. After the concatenation, the layers are gone.

-----------------------------------------
// Create a work array for sorting, making it only big enough to hold elements with names in them
// Copy the input array to the sorting array
// Sort it
Stream[] inStreams = new Stream[iFx];
string[] sortNames = new string[iFx];
Array.Copy(sFileName, sortNames, sortNames.Length);
Array.Sort(sortNames);

for (int i = 0; i < iFx; i++) {
String str1 = sortNames[i];
String strFull = diFullName + "\\" + str1;
if (debug) clog.LogMessage("strFull=" + strFull);
FileStream inStream1 = new FileStream(strFull, FileMode.Open);
inStreams[i] = inStream1;
if (debug) clog.LogMessage("added to array inStreams=" + inStream1.Name);
}


// Open an output file to put the merged PDFs in
strOutputFileName = diFullName + "\\" + strOutputFileName;

//Create output stream object of the final PDF file
FileStream outStream = new FileStream(strOutputFileName, FileMode.Create);
if (debug) clog.LogMessage("Output file created=" + strOutputFileName);

//Instantiate PdfFileEditor object
PdfFileEditor pdfEditor = new PdfFileEditor();


//Call Concatenate method of PdfFileEditor object to concatenate all input streams
//into a single output stream
pdfEditor.Concatenate(inStreams, outStream);
if (debug) clog.LogMessage("Concatenation into output file done...");

//Finally close the output stream
outStream.Close();
if (debug) clog.LogMessage("Outstream closed...");
---------------------------------

Hi Steve,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for sharing the details.

Please do share your template PDF files with us. This will help us figure out the issue soon.

Sorry for the inconvenience,

Hi Nauserwan,

Our drawings are proprietary and can't be released off base so I'll have to put together some examples. I'll do that ASAP and get you some before and after files.

thanks!

Steve

Attached is a zip file containing 6 files. Five of them (LAYER_1.pdf - LAYER_5.pdf) are single page files, each having 7 layers. The 6th file (LayerTest_MultiSheet.pdf) is a 5 page PDF file consisting of the five single page files.

The layers in the single page files can be seen, and turned on and off, by viewing the files with Acrobat Reader.

When they are combined, all the layers are removed and the resulting file is flat.

I can furnish you with the code that combines the files, but it is basically done using the concatenate method of PdfFileEditor.

Thanks

Steve

Hi Steve,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for sharing the template files.

I am able to reproduce the issue using your shared files. Your issue has been registered in our issue tracking system with issue id: PDFNEWNET-34046. You will be notified via this forum thread regarding any updates against your reported issue.

Sorry for the inconvenience,

I know I would hear if this one had been completed but it's been a while and I am wondering if there has been any progress made.

Thanks

Steve

The issues you have found earlier (filed as PDFNEWNET-34046) have been fixed in Aspose.Pdf for .NET 7.7.0.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.