Damn, a lot of try and error later I found the solution in using itextSharp also!
Only working with PDFSharp doesn't worked. Tried also the same approach I did now with iTextsharp by using pdfSharp but got no result.
So for all other people facing a same problem, here is how I do it now
![Wink ;)](./images/smilies/icon_wink.gif)
Code:
/// <summary>
/// Creates the PDF sharp conform PDF file from infragistics PDF file.
/// THIS IS ONLY A MUST NEED BECAUSE THE PDF OF INFRAGISTICS SAVES ITS CONTENT COMPRESSED BY .NET ALGORITHM.
/// BUT PDFSHARP USES THE JAVA COMPRESSION/DECOMPRESSION ALGORITHM TO READ IT IN -> THIS FAILS WITH AN DECOMPRESSION EXCEPTION!
/// So we read in the pdf by iTextshap and generate a new pdf by it with uncompressed! content. This file can be used by PDFSharp also!
/// </summary>
/// <param name="infragisticsPDF">The infragistics PDF.</param>
/// <returns>System.String.</returns>
private string createPDFSharpConformPDFFileFromInfragisticsPDFFile(string infragisticsPDF)
{
//readin file and create a new doc for it
iTextSharp.text.pdf.PdfReader inputReader = new iTextSharp.text.pdf.PdfReader(infragisticsPDF);
iTextSharp.text.Rectangle newRect = inputReader.GetPageSize(1);
iTextSharp.text.Document doc = new iTextSharp.text.Document(newRect);
doc.SetMargins(0, 0, 0, 0);
iTextSharp.text.Document.Compress = false; //THIS LINE IS IMPORTANT -> RESAVE FILE AS UNCOMPRESSED VERSION!
//set ouput file
var correctedFilePath = Path.Combine(_reportObjectSettings.TemporaryFilePathForSinglePdfFiles, Path.GetFileNameWithoutExtension(infragisticsPDF) + "_uncompressed.pdf");
iTextSharp.text.pdf.PdfWriter outputWriter = iTextSharp.text.pdf.PdfWriter.GetInstance(doc, new FileStream(correctedFilePath, FileMode.Create));
outputWriter.SetPdfVersion(iTextSharp.text.pdf.PdfWriter.PDF_VERSION_1_4); //only to get sure!
doc.Open();
//now write/copy each page of it into new doc
iTextSharp.text.pdf.PdfContentByte cb = outputWriter.DirectContent;
for (int pageNumber = 1 ; pageNumber <= inputReader.NumberOfPages ; pageNumber++)
{
iTextSharp.text.pdf.PdfImportedPage page = outputWriter.GetImportedPage(inputReader, pageNumber);
cb.AddTemplate(page, 0, 0);
doc.NewPage();
}
doc.Close();
doc = null;
return correctedFilePath;
}