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

More
9 years 3 months ago #11534 by Shades
Hello,
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 :)
More
9 years 3 months ago #11538 by support
Where are you receiving that error string from?
May you provide us your corrupted file?
Which RadaeePDF SDK version are you adopting?
More
9 years 3 months ago #11539 by Shades
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.
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; }
More
9 years 3 months ago #11540 by support
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.
More
9 years 3 months ago #11552 by Shades
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.
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);
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 :)
More
9 years 3 months ago #11555 by support
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.
Time to create page: 0.430 seconds
Powered by Kunena Forum