get_Width Exception

Hi. I have a 300dpi scanned image I''m trying to create a PDF from. Image is a TIF file format. I open it manually using .NET, then I get the width and obtain the inches based on image dpi (300 in thie case, the resulting document dimensions are 8.5"x11"). I take these dimensions and multiply them by 72, to aquire a point value. I do this because I assume I have to. Then I Create a PDFDocument, remove the default page, then create a new page with the dimensions I''ve calculated. Then I specify that I want my image to take up the entire space of the page I just created. I use the same SizeF structure used to create the page. I get the following exception (reflection dump): Message= Invalid parameter used. TargetSite= Int32 get_Width() StackTrace= at System.Drawing.Image.get_Width() at Syncfusion.Pdf.Implementation.Objects.PDFImage.get_Width() at Syncfusion.Pdf.Implementation.Objects.PDFImage.AddRequiredItems() at Syncfusion.Pdf.Implementation.Objects.PDFImage.SaveObject(IPDFWriter writer) at Syncfusion.Pdf.Implementation.Objects.PDFObject.Save(IPDFWriter writer) at Syncfusion.Pdf.Implementation.Objects.PDFIndirectObject.SaveObject(IPDFWriter writer) at Syncfusion.Pdf.Implementation.Objects.PDFObject.Save(IPDFWriter writer) at Syncfusion.Pdf.PDFDocument.SaveIndirectObject(IPDFObject pdf, IPDFWriter stream, IPDFCompressor compressor) at Syncfusion.Pdf.PDFDocument.SaveIndirectObject(IPDFObject pdf, IPDFWriter stream) at Syncfusion.Pdf.PDFDocument.SaveImages(IPDFWriter stream) at Syncfusion.Pdf.PDFDocument.Save(IPDFWriter stream) at Syncfusion.Pdf.PDFDocument.Save(String fileName) at Infocus.ExportApi.ExportWorker.CreatePdfDocument(Guid documentId, IList fileListing, String storagePath, StatusHelper statusHelper) in c:\code\infocus\infocus.exportapi\infocus.exportapi\exportworker.cs:line 282 Source= System.Drawing Any suggestions at allwould be appreciated. I can provide sample source code as the total pdf code is only maybe 10 lines or so. If I do not attempt to draw the image to the document everything works ok, except the result pdf page has no image (blank page). Thanks!

4 Replies

AD Administrator Syncfusion Team January 20, 2005 04:51 PM UTC

Hi Shaun, Currently there is no support for inserting TIF images, so i would assume that this is whats causing the exception. We will add support for TIF images within two weeks time. If possible, please create a Direc-Trac incident with the sample TIF file that you are trying to insert. Thanks. Best regards, Stephen. >Hi. I have a 300dpi scanned image I''m trying to create a PDF from. > >Image is a TIF file format. I open it manually using .NET, then I get the width and obtain the inches based on image dpi (300 in thie case, the resulting document dimensions are 8.5"x11"). > >I take these dimensions and multiply them by 72, to aquire a point value. I do this because I assume I have to. > >Then I Create a PDFDocument, remove the default page, then create a new page with the dimensions I''ve calculated. > >Then I specify that I want my image to take up the entire space of the page I just created. I use the same SizeF structure used to create the page. > >I get the following exception (reflection dump): > > Message= Invalid parameter used. > TargetSite= Int32 get_Width() > StackTrace= at System.Drawing.Image.get_Width() > at Syncfusion.Pdf.Implementation.Objects.PDFImage.get_Width() > at Syncfusion.Pdf.Implementation.Objects.PDFImage.AddRequiredItems() > at Syncfusion.Pdf.Implementation.Objects.PDFImage.SaveObject(IPDFWriter writer) > at Syncfusion.Pdf.Implementation.Objects.PDFObject.Save(IPDFWriter writer) > at Syncfusion.Pdf.Implementation.Objects.PDFIndirectObject.SaveObject(IPDFWriter writer) > at Syncfusion.Pdf.Implementation.Objects.PDFObject.Save(IPDFWriter writer) > at Syncfusion.Pdf.PDFDocument.SaveIndirectObject(IPDFObject pdf, IPDFWriter stream, IPDFCompressor compressor) > at Syncfusion.Pdf.PDFDocument.SaveIndirectObject(IPDFObject pdf, IPDFWriter stream) > at Syncfusion.Pdf.PDFDocument.SaveImages(IPDFWriter stream) > at Syncfusion.Pdf.PDFDocument.Save(IPDFWriter stream) > at Syncfusion.Pdf.PDFDocument.Save(String fileName) > at Infocus.ExportApi.ExportWorker.CreatePdfDocument(Guid documentId, IList fileListing, String storagePath, StatusHelper statusHelper) in c:\code\infocus\infocus.exportapi\infocus.exportapi\exportworker.cs:line 282 > Source= System.Drawing > >Any suggestions at allwould be appreciated. I can provide sample source code as the total pdf code is only maybe 10 lines or so. If I do not attempt to draw the image to the document everything works ok, except the result pdf page has no image (blank page). > >Thanks! >


SW Shaun Wilson January 20, 2005 11:56 PM UTC

Still no dice. Maybe I need to look at alternatives. Or maybe someone has a support mailing address, I was unable to locate one on the website. Thanks.


SW Shaun Wilson January 21, 2005 12:10 AM UTC

>Currently there is no support for inserting TIF images, I saw this as the bulk of overloads for loading from a file stated that. However I have opened the TIF image into a .NET Bitmap object. I assumed this warning was targeting those user who were most interested in specifying a .TIF file as the filename property to drawimage. I thought that by loading the image myself, it would not matter. Tomorrow I will try and load a JPEG instead, then a BMP file. Does Essential PDF still care that the original file was a .TIF, I was not aware that the .NET Bitmap object would carry that kind of information arround. With this new information I will create a copy of my Bitmap object manually. If that doesn''t solve the problem, maybe there''s a deeper issue that has nothing to do with the file format, but maybe with the pixel format. Can Essential PDF consume indexed images (such as a 1bpp bitmap)? > [...] i would assume that this is whats causing the exception. We will add support for TIF images within two weeks time. That''s good news, I was surprised to see such limited support in Essential PDF, after all .NET itself allows developers to work with at least 6 different file formats. The only core limitations are on its ability to write to indexed DIB surfaces. > If possible, please create a Direc-Trac incident with the sample TIF file that you are trying to insert. Thanks. I will put together a small sample application for your staff. Currently we have TIF, PNG, EWF, PCX, BMP, GIF and JPEG file formats in our system. I will provide sample media for each format as well. I have put off testing Essential PDF until I received a response. I will test all other file formats here as well, and send my test app along to te Direc-trac (?) web. >Best regards, > >Stephen. One last question. Is the source code to Essential PDF available with the source code purchase option of the suite? (I think I saw a source code option, I may be mistaken). Thanks.


AD Administrator Syncfusion Team January 21, 2005 11:49 AM UTC

Hi Shaun, We were able to reproduce this issue with a file that another customer had set us. Its a bug in the current version. We will fix this bug within a day or two and have an updated build available for download. You can also use Direc-Trac for submitting support incidents. http://www.syncfusion.com/Support/DirectTrac/logon.aspx?URL=/Support/DirectTrac/default.aspx Thanks. Best regards, Stephen. >>Currently there is no support for inserting TIF images, > >I saw this as the bulk of overloads for loading from a file stated that. However I have opened the TIF image into a .NET Bitmap object. I assumed this warning was targeting those user who were most interested in specifying a .TIF file as the filename property to drawimage. > >I thought that by loading the image myself, it would not matter. > >Tomorrow I will try and load a JPEG instead, then a BMP file. > >Does Essential PDF still care that the original file was a .TIF, I was not aware that the .NET Bitmap object would carry that kind of information arround. > >With this new information I will create a copy of my Bitmap object manually. If that doesn''t solve the problem, maybe there''s a deeper issue that has nothing to do with the file format, but maybe with the pixel format. > >Can Essential PDF consume indexed images (such as a 1bpp bitmap)? > > >> [...] i would assume that this is whats causing the exception. We will add support for TIF images within two weeks time. > >That''s good news, I was surprised to see such limited support in Essential PDF, after all .NET itself allows developers to work with at least 6 different file formats. The only core limitations are on its ability to write to indexed DIB surfaces. > >> If possible, please create a Direc-Trac incident with the sample TIF file that you are trying to insert. Thanks. > >I will put together a small sample application for your staff. Currently we have TIF, PNG, EWF, PCX, BMP, GIF and JPEG file formats in our system. I will provide sample media for each format as well. I have put off testing Essential PDF until I received a response. I will test all other file formats here as well, and send my test app along to te Direc-trac (?) web. > >>Best regards, >> >>Stephen. > >One last question. Is the source code to Essential PDF available with the source code purchase option of the suite? (I think I saw a source code option, I may be mistaken). > >Thanks. >

Loader.
Up arrow icon