- Posts: 37
- Thank you received: 0
Microsoft Windows Phone 8.1 support ends (13 Jul 2017)
Microsoft has ended support for Windows Phone 8.1
Questions about iOS development and PDF
Corrupt JPEG data: 90 extraneous bytes before mark
9 years 3 months ago #11534
by Shades
Corrupt JPEG data: 90 extraneous bytes before mark was created by Shades
Hello,
I have a strange issue,after adding the bitmap to the pdf :
Any idea please ?
Thank you
I have a strange issue,after adding the bitmap to the pdf :
Code:
Corrupt JPEG data: 90 extraneous bytes before marker
Any idea please ?
Thank you
9 years 3 months ago #11538
by support
Replied by support on topic Corrupt JPEG data: 90 extraneous bytes before mark
Where are you receiving that error string from?
May you provide us your corrupted file?
Which RadaeePDF SDK version are you adopting?
May you provide us your corrupted file?
Which RadaeePDF SDK version are you adopting?
9 years 3 months ago #11539
by Shades
Replied by Shades on topic Corrupt JPEG data: 90 extraneous bytes before mark
Hello,
Well,I got that error with all pdf I use.I use the last version of Radaee 3.7. it's after adding a bitmap to the pdf.
Well,I got that error with all pdf I use.I use the last version of Radaee 3.7. it's after adding a bitmap to the pdf.
Code:
- (NSData *)vAddImage:(NSString*)sPath imageView:(CGRect)frame path:(NSString *)path page:(int)p
{
struct PDFV_POS pos1;
struct PDFV_POS pos2;
[m_view vGetPos:&pos1 :frame.origin.x * m_scale :frame.origin.y * m_scale];
[m_view vGetPos:&pos2 :(frame.origin.x + frame.size.width) * m_scale :(frame.origin.y + frame.size.height) * m_scale];
PDF_RECT rect =_rect;
rect.left = pos1.x;
rect.right = pos2.x;
rect.top = pos2.y;
rect.bottom = pos1.y;
NSString *tp = NSTemporaryDirectory();
tp = [tp stringByAppendingPathComponent:@"cache.dat"];
[m_doc setCache:tp];
PDFPage *page = [m_doc page:p];
PDFDocImage *i = [m_doc newImageJPEG:sPath];
[page addAnnotBitmap:i :&(_rect)];
[m_view vRenderSync:p];
[self refresh];
[m_doc save];
NSData *pdfData = [[NSFileManager defaultManager]contentsAtPath:path];
return pdfData;
}
9 years 3 months ago #11540
by support
Replied by support on topic Corrupt JPEG data: 90 extraneous bytes before mark
I'm forwarding your post to dev team.
I've one missing answer: which application or framework are you testing to retrive "Corrupt JPEG data: 90 extraneous bytes before marker"?
We'd like to completely reproduce your environment.
I've one missing answer: which application or framework are you testing to retrive "Corrupt JPEG data: 90 extraneous bytes before marker"?
We'd like to completely reproduce your environment.
9 years 3 months ago #11552
by Shades
Replied by Shades on topic Corrupt JPEG data: 90 extraneous bytes before mark
Hello,
Thank you a lot for your reply.
I got the point.! When I try to retrieve the NSData from the image I get that issue of the corrupt JPEG.
However with
I don't get that problem.But it doesn't keep the transparency of the image.
Any idea how I can add a bitmap with keeping its transparent background ?
Thank you for your help
Thank you a lot for your reply.
I got the point.! When I try to retrieve the NSData from the image I get that issue of the corrupt JPEG.
Code:
NSData *data =UIImagePNGRepresentation(sPreview.image);
[data writeToFile:filePath options:NSDataWritingAtomic error:&error];
[m_view vAddImage:imgPath frame:frame path:filePath page:page];// the function of the last post
However with
Code:
UIImageJPEGRepresentation(sPreview.image, 1);
Any idea how I can add a bitmap with keeping its transparent background ?
Thank you for your help
9 years 3 months ago #11555
by support
Replied by support on topic Corrupt JPEG data: 90 extraneous bytes before mark
JPEG images are stored with RGB pixels and don't allow transparencies.
To store/retrive alpha channel jpeg2000 should be your choice but it's not simple as actual operating system (iOS, Android) don't expose native API to handle such a format.
en.wikipedia.org/wiki/JPEG_2000#Side_cha..._spatial_information
If you've no size constrains you should add new image without any compression.
Note about JPEG2000: it's really CPU intensive.
To store/retrive alpha channel jpeg2000 should be your choice but it's not simple as actual operating system (iOS, Android) don't expose native API to handle such a format.
en.wikipedia.org/wiki/JPEG_2000#Side_cha..._spatial_information
If you've no size constrains you should add new image without any compression.
Note about JPEG2000: it's really CPU intensive.
Time to create page: 0.430 seconds