Signin/Signup with: 
Welcome, Guest
Username: Password: Remember me
Questions about iOS development and PDF
  • Page:
  • 1
  • 2

TOPIC:

Corrupt JPEG data: 90 extraneous bytes before mark 7 years 4 months ago #11534

  • Shades
  • Shades's Avatar Topic Author
  • Offline
  • User is blocked
  • User is blocked
  • Posts: 37
  • Thank you received: 0
Hello,
I have a strange issue,after adding the bitmap to the pdf :
Corrupt JPEG data: 90 extraneous bytes before marker


Any idea please ?


Thank you :)

Please Log in or Create an account to join the conversation.

Corrupt JPEG data: 90 extraneous bytes before mark 7 years 4 months ago #11538

  • support
  • support's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 690
  • Thank you received: 59
Where are you receiving that error string from?
May you provide us your corrupted file?
Which RadaeePDF SDK version are you adopting?

Please Log in or Create an account to join the conversation.

Corrupt JPEG data: 90 extraneous bytes before mark 7 years 4 months ago #11539

  • Shades
  • Shades's Avatar Topic Author
  • Offline
  • User is blocked
  • User is blocked
  • Posts: 37
  • Thank you received: 0
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.
- (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;
}

Please Log in or Create an account to join the conversation.

Corrupt JPEG data: 90 extraneous bytes before mark 7 years 4 months ago #11540

  • support
  • support's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 690
  • Thank you received: 59
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.

Please Log in or Create an account to join the conversation.

Corrupt JPEG data: 90 extraneous bytes before mark 7 years 4 months ago #11552

  • Shades
  • Shades's Avatar Topic Author
  • Offline
  • User is blocked
  • User is blocked
  • Posts: 37
  • Thank you received: 0
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.
  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
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 :)

Please Log in or Create an account to join the conversation.

Corrupt JPEG data: 90 extraneous bytes before mark 7 years 4 months ago #11555

  • support
  • support's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 690
  • Thank you received: 59
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.

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
  • 2
Powered by Kunena Forum