Free Support Forum - aspose.com

Aspose.PDF : BarCode is not appearing After Merging the PDF Documents Using PdfFileEditor Concatenate Method in .Net

Hello , Merged PDF is not displaying the Barcodes after merging multiple pdf documents using pdffileeditor object.

we are able to see the Barcodes by opening in Adobe acrobat reader. Once it get merged through Pdffileeditor Concatenate, Merged PDF not displaying the Barcodes. please help me on this.

ex: PdfFileEditor pfe = new PdfFileEditor();
string[] files = Directory.GetFiles(onlypdffilepath);
pfe.CopyOutlines = false;
pfe.Concatenate(files, targetpdf);

@umamaheshrao,

Kindly send us your source PDF documents. We will investigate your scenario in our environment and share our findings with you.

@imran.rafique

I am from same team as Umamaheshwar. Please find the attached 2 PDF documents, one of them has a bar code. When we concatenate these 2 files, the bar code in the PDF is removed.

SamplePDFWithOutBarCode.pdf (370.4 KB)
SamplePDFWithBarCode.pdf (493.8 KB)

@akshathapaik,

Please try this code to concatenate the source PDF documents:
C#

string dataDir = @"C:\Pdf\test756\";
// Open first document
Document pdfDocument1 = new Document(dataDir + "Concat1.pdf");
// Open second document
Document pdfDocument2 = new Document(dataDir + "Concat2.pdf");
// Add pages of second document to the first 
pdfDocument1.Pages.Add(pdfDocument2.Pages);
dataDir = dataDir + "ConcatenatePdfFiles_out.pdf";
// Save concatenated output file
pdfDocument1.Save(dataDir); 

This is the output PDF document: ConcatenatePdfFiles_out.pdf (687.6 KB)

@imran.rafique,

Thank you so much for your reply.I have tried the code which you shared but it is displaying the barcodes when we add the non barcode pdf pages to the barcode pdf pages. actually in our requirement we need to merge the pdfs based on the sequence of the pdf documents so the barcode forms can be at any place of the merged output pdf. please let us know any possiblity using the aspose.pdf.PdfFileEditor.Concatenate method.

for example : it is working when we adding pdfDocument2(without barcodes) document pages to pdfDocument1(with barcodes) pages but it is not working when we add pdfDocument1(with barcode) Pages to pdfDocument2(without barcodes) Pages.

            string path1 = "E:\\Binder_3_30_2018\\";
            string path2 = "E:\\Binder_3_30_2018\\test1\\";
            //Open first document
            Aspose.Pdf.Document pdfDocument2 = new Aspose.Pdf.Document(path2 + "SamplePDFWithOutBarCode.pdf");
            //Open second document
            Aspose.Pdf.Document pdfDocument1 = new Aspose.Pdf.Document(path2 + "SamplePDFWithBarCode.pdf");
            //Add pages of second document to the first
            pdfDocument1.Pages.Add(pdfDocument2.Pages);
            path2 = path2 + "ConcatenatePdfFiles_out.pdf";
            //Save concatenated output file
            pdfDocument1.Save(path2);

@umamaheshrao,

We managed to replicate the problem of missing barcodes with the Concatenate method of PdfFileEditor class. It has been logged under the ticket ID PDFNET-44469 in our bug tracking system. We have linked your post to this ticket and will keep you informed regarding any available updates.

In order to concatenate PDF documents in a sequence, you can build a string array as per the required sequence, and then repeat the process to add pages as follows:
C#

string[] files = Directory.GetFiles(@"C:\Pdf\test756\files\");
Document pdfDocument = new Document(files[0]);
for (int i = 1; i < files.Length; i++)
{
    Document document = new Document(files[i]);
    pdfDocument.Pages.Add(document.Pages);
}
pdfDocument.Save(@"C:\Pdf\test756\Output_18.3.pdf");

@imran.rafique,

Thank you for your quick reply and creating a bug . it would be great if you let us know the bug fixing duration so we can inform to our business and we have found in .net forum saying that the issue is resolved in next release in long back. here i am attaching the link. please let us know if you need any more information.

http://www.vbdotnetforums.com/showthread.php/44090-Concatenate-Files-with-Barcode-Fields-amp-Illustrator-Files-Support

@umamaheshrao,

The linked ticket ID PDFNET-44469 has just been identified and could take time under the free support model. In order to escalate priority, we recommend our clients to post their critical issues (ticket Ids) in the paid support forum. Please refer to this helping link: Aspose support options. Furthermore, we have shared a workaround and you can use this till the original fix.