Subject: Error thrown when merging pdf documents that are created by an EPSON Perfection V30 scanner
Date: 2011-06-07 13:17:48
From: Bob Pope
Source: error-thrown-merging-pdf-documents-created-epson-perfection-v30-scanner

We have a problem when merging pdf documents that are created by an EPSON Perfection V30 scanner.  A report is generated as pdf - 1.5 by MS SQL Server Reporting Services. The attachments are generated as pdf - 1.4 by the various scanners we have tested.  So far using scanners from Cannon, Ricoh & HP we have not had any problems, the EPSON problem is repeatable across mutiple scanners of the same type. This is a problem for us as this is the scanner many of our field people are using.

The pdf generated by the EPSON is fully viewable and printable in Acrobat v8 - v10 and we are able to save it as a byte stream to a database and retrieve it without difficulty.  When we attempt to merge the documents from SSRS and the EPSON  we receive the following error: “Error Unable to cast object of type '?' to type '?'.” where the '?'s indicated charactes of the Estrangelo Edessa font family, uicode characters 0714 (Syriac letter Gamal Garshuni) and 0710 (Syriac letter Alaph) respectivly.

UPDATE: Since we bought the source code license I've added it to my project and and I can tell you that when I call PdfDocument.Merge() the following error is returned ex = {"Unable to cast object of type 'ComponentPro.Pdf.Primitives.PdfReferenceHolder' to type 'ComponentPro.Pdf.Primitives.PdfNumber'."}

This is the stack trace:
StackTrace = "   
   at ComponentPro.Pdf.PdfPageBase.GetRotation()
   at ComponentPro.Pdf.PdfPageBase.get_Rotation()
   at ComponentPro.Pdf.PdfDocumentPageCollection.AddInt(PdfImportedDocument ldDoc, PdfPageBase page, ArrayList destinations)
   at ComponentPro.Pdf.PdfDocument.ClonePage(PdfImportedDocument ldDoc, PdfPageBase page, ArrayList destinations)
   at ComponentPro.Pdf.PdfDocumentBase.ImportPageRange(PdfImportedDocument ldDoc, Int32 startIndex, Int32 endIndex)
   at ComponentPro.Pdf.PdfDocumentBase.Append(PdfImportedDocument ldDoc)
   at ComponentPro.Pdf.PdfDocumentBase.Merge(PdfDocumentBase dest, Object[] sourceDocuments)
   at ExpenseReport.Web.ClientBin.ReportViewer.MergeAttachments(Byte[] masterReport, Int32 rowID) in C:\<internal path>\ReportViewer.aspx.cs:line 253

The error is being generated in PdfPageBase.cs at the following line:

415                 number = (PdfNumber) dictionary["Rotate"];

The values for the dictionary object "Rotate" are listed below:

-  dictionary {ComponentPro.Pdf.Primitives.PdfDictionary} ComponentPro.Pdf.Primitives.PdfDictionary

-  m_crossTable {ComponentPro.Pdf.IO.PdfCrossTable} ComponentPro.Pdf.IO.PdfCrossTable
  Count 24 int
+  CrossTable {ComponentPro.Pdf.IO.CrossTable} ComponentPro.Pdf.IO.CrossTable
+  Document {ComponentPro.Pdf.PdfFile.PdfImportedDocument} ComponentPro.Pdf.PdfDocumentBase {ComponentPro.Pdf.PdfFile.PdfImportedDocument}
+  DocumentCatalog {ComponentPro.Pdf.Primitives.PdfDictionary} ComponentPro.Pdf.Primitives.PdfDictionary
+  Encryptor null ComponentPro.Pdf.Security.PdfEncryptor
+  EncryptorDictionary null ComponentPro.Pdf.Primitives.PdfDictionary
  m_archive null ComponentPro.Pdf.IO.PdfArchiveStream
+  m_archives null System.Collections.ArrayList
  m_bDisposed false bool
  m_bForceNew false bool
  m_count 24 int
+  m_crossTable {ComponentPro.Pdf.IO.CrossTable} ComponentPro.Pdf.IO.CrossTable
+  m_document {ComponentPro.Pdf.PdfFile.PdfImportedDocument} ComponentPro.Pdf.PdfDocumentBase {ComponentPro.Pdf.PdfFile.PdfImportedDocument}
+  m_documentCatalog {ComponentPro.Pdf.Primitives.PdfDictionary} ComponentPro.Pdf.Primitives.PdfDictionary
+  m_encryptorDictionary null ComponentPro.Pdf.Primitives.PdfDictionary
+  m_items {ComponentPro.Pdf.IO.PdfMainObjectCollection} ComponentPro.Pdf.IO.PdfMainObjectCollection
+  m_mappedReferences null System.Collections.Hashtable
  m_maxGenNumIndex 0 long
+  m_objects Count = 0 System.Collections.Hashtable
+  m_objNumbers Count = 0 System.Collections.Stack
  m_storedCount 0 int
+  m_stream {System.IO.MemoryStream} System.IO.Stream {System.IO.MemoryStream}
+  m_trailer {ComponentPro.Pdf.Primitives.PdfDictionary} ComponentPro.Pdf.Primitives.IPdfPrimitive {ComponentPro.Pdf.Primitives.PdfDictionary}
  NextObjNumber 24 int
+  ObjectCollection {ComponentPro.Pdf.IO.PdfMainObjectCollection} ComponentPro.Pdf.IO.PdfMainObjectCollection
+  PdfObjects {ComponentPro.Pdf.IO.PdfMainObjectCollection} ComponentPro.Pdf.IO.PdfMainObjectCollection
+  Stream {System.IO.MemoryStream} System.IO.Stream {System.IO.MemoryStream}
+  Trailer {ComponentPro.Pdf.Primitives.PdfDictionary} ComponentPro.Pdf.Primitives.PdfDictionary
  m_object null ComponentPro.Pdf.Primitives.IPdfPrimitive
  m_objectIndex 7 int
-  m_reference {8 0 R} ComponentPro.Pdf.Primitives.PdfReference
  GenNum 0 int
  ObjNum 8 long
-  Object {ComponentPro.Pdf.Primitives.PdfNumber} ComponentPro.Pdf.Primitives.IPdfPrimitive {ComponentPro.Pdf.Primitives.PdfNumber}
-  [ComponentPro.Pdf.Primitives.PdfNumber] {ComponentPro.Pdf.Primitives.PdfNumber} ComponentPro.Pdf.Primitives.PdfNumber
  FloatValue 90.0 float
  IntValue 90 int
  IsInteger true bool
  m_floatValue 90.0 float
  m_intValue 90 int
  m_isInteger true bool
-  Reference {8 0 R} ComponentPro.Pdf.Primitives.PdfReference
  GenNum 0 int
  ObjNum 8 long


The only code common in this process is the code we have written that sends the document to the UltimatePDF components we have purchased from you. Our code does not use cast any types and would have trapped the error so we are assuming it is being generated from within the UltimatePDF code.

---------------------------------------------------------------------- Note: This question has been asked on the Q&A forum of Thang Dang's fraudulent ComponentPro brand If you purchased anything from ComponentPro, you have been scammed. Contact the payment processor who sold you the license and ask for your money back. Back to ComponentPro Q&A Forum Index