Load PDF From Memory using Adobe Acrobat SDK

Load PDF From Memory using Adobe Acrobat SDK

//The below variables are global;
DWORD FileSize;//size of main PDF file
char * lpBuffer;//PDF buffer,please save binary PDF data into this buffer
DWORD dwDataSize;//size of main PDF file
DWORD dwDataIndex;//is a pointer for lpBuffer position.ex. lpBuffer[dwDataIndex]
//write the following code in the initialzation of your application
ASFileSys myFileSys;
memset (&MyFileSys, 0, sizeof(ASFileSysRec));
MyFileSys.size = sizeof(ASFileSysRec);
MyFileSys.open = ASCallbackCreateProto (ASFileSysOpenProc, MyASFileSysOpenProc);
MyFileSys.close = ASCallbackCreateProto (ASFileSysCloseProc, MyASFileSysCloseProc);
MyFileSys.flush = ASCallbackCreateProto (ASFileSysFlushProc, MyASFileSysFlushProc);
MyFileSys.setpos = ASCallbackCreateProto (ASFileSysSetPosProc, MyASFileSysSetPosProc);
MyFileSys.getpos = ASCallbackCreateProto (ASFileSysGetPosProc, MyASFileSysGetPosProc);
MyFileSys.seteof = ASCallbackCreateProto (ASFileSysSetEofProc, MyASFileSysSetEofProc);
MyFileSys.geteof = ASCallbackCreateProto (ASFileSysGetEofProc, MyASFileSysGetEofProc);
MyFileSys.read = ASCallbackCreateProto (ASFileSysReadProc, MyASFileSysReadProc);
MyFileSys.write = ASCallbackCreateProto (ASFileSysWriteProc, MyASFileSysWriteProc);
MyFileSys.remove = ASCallbackCreateProto (ASFileSysRemoveProc, MyASFileSysRemoveProc);
MyFileSys.rename = ASCallbackCreateProto (ASFileSysRenameProc, MyASFileSysRenameProc);
MyFileSys.isSameFile = ASCallbackCreateProto (ASFileSysIsSameFileProc, MyASFileSysIsSameFileProc);
MyFileSys.getName = ASCallbackCreateProto (ASFileSysGetNameProc, MyASFileSysGetNameProc);
MyFileSys.getNameAsASText = ASCallbackCreateProto (ASFileSysGetNameAsASTextProc, MyASFileSysGetNameAsASTextProc);
MyFileSys.getTempPathName = ASCallbackCreateProto (ASFileSysGetTempPathNameProc, MyASFileSysGetTempPathNameProc);
MyFileSys.copyPathName = ASCallbackCreateProto (ASFileSysCopyPathNameProc, MyASFileSysCopyPathNameProc);
MyFileSys.diPathFromPath = ASCallbackCreateProto (ASFileSysDiPathFromPathProc, MyASFileSysDiPathFromPathProc);
MyFileSys.pathFromDIPath = ASCallbackCreateProto (ASFileSysPathFromDIPathProc, MyASFileSysPathFromDIPathProc);
MyFileSys.disposePathName = ASCallbackCreateProto (ASFileSysDisposePathNameProc, MyASFileSysDisposePathNameProc);
MyFileSys.getFileSysName = ASCallbackCreateProto (ASFileSysGetFileSysNameProc, MyASFileSysGetFileSysNameProc);
MyFileSys.getStorageFreeSpace = ASCallbackCreateProto (ASFileSysGetStorageFreeSpaceProc, MyASFileSysGetStorageFreeSpaceProc);
MyFileSys.flushVolume = ASCallbackCreateProto (ASFileSysFlushVolumeProc, MyASFileSysFlushVolumeProc);
MyFileSys.createPathName = ASCallbackCreateProto (ASFileSysCreatePathNameProc, MyASFileSysCreatePathNameProc);
MyFileSys.getItemProps = ASCallbackCreateProto (ASFileSysGetItemPropsProc, MyASFileSysGetItemPropsProc);
MyFileSys.firstFolderItem = ASCallbackCreateProto (ASFileSysFirstFolderItemProc, MyASFileSysFirstFolderItemProc);
MyFileSys.nextFolderItem = ASCallbackCreateProto (ASFileSysNextFolderItemProc, MyASFileSysNextFolderItemProc);
MyFileSys.destroyFolderIterator = ASCallbackCreateProto (ASFileSysDestroyFolderIteratorProc, MyASFileSysDestroyFolderIteratorProc);
MyFileSys.urlFromPath = ASCallbackCreateProto (ASFileSysURLFromPathProc, MyASFileSysURLFromPathProc);
MyFileSys.getParent = ASCallbackCreateProto (ASFileSysGetParentProc, MyASFileSysGetParentProc);
MyFileSys.createFolder = ASCallbackCreateProto (ASFileSysCreateFolderProc, MyASFileSysCreateFolderProc);
MyFileSys.removeFolder = ASCallbackCreateProto (ASFileSysRemoveFolderProc, MyASFileSysRemoveFolderProc);
MyFileSys.displayStringFromPath = ASCallbackCreateProto (ASFileSysDisplayStringFromPathProc, MyASFileSysDisplayStringFromPathProc);
MyFileSys.setTypeAndCreator = ASCallbackCreateProto (ASFileSysSetTypeAndCreatorProc, MyASFileSysSetTypeAndCreatorProc);
MyFileSys.getTypeAndCreator = ASCallbackCreateProto (ASFileSysGetTypeAndCreatorProc, MyASFileSysGetTypeAndCreatorProc);
//These need to be implemented for 7.0 Windows
MyFileSys.acquirePlatformPath = ASCallbackCreateProto (ASFileSysAcquirePlatformPathProc, MyASFileSysAcquirePlatformPathProc);
MyFileSys.releasePlatformPath = ASCallbackCreateProto (ASFileSysReleasePlatformPathProc, MyASFileSysReleasePlatformPathProc);
//MYFileSys Callbacks Functions definations
static ACCB1 ASInt32 ACCB2 MyASFileSysOpenProc (ASPathName pathName, ASUns16 mode, MDFile *fP)
dwDataIndex = 0;
dwDataSize  = FileSize;//size of main PDF file
return 0;
static ACCB1 ASInt32 ACCB2 MyASFileSysCloseProc (MDFile f)
dwDataIndex = 0;//set PDF buffer pointer to zero
return 0;
static ACCB1 ASInt32 ACCB2 MyASFileSysFlushProc (MDFile f)
return 0;
static ACCB1 ASInt32 ACCB2 MyASFileSysSetPosProc (MDFile f, ASUns32 pos)
dwDataIndex = (DWORD)pos;
return 0;
static ACCB1 ASInt32 ACCB2 MyASFileSysGetPosProc (MDFile f, ASUns32 *pos)
*pos = (ASFilePos)dwDataIndex;
return 0;
static ACCB1 ASInt32 ACCB2 MyASFileSysSetEofProc (MDFile f, ASUns32 pos)
return 0;
static ACCB1 ASInt32 ACCB2 MyASFileSysGetEofProc (MDFile f, ASUns32 *pos)
*pos = (ASFilePos)dwDataSize;
return 0;
static ACCB1 ASSize_t ACCB2 MyASFileSysReadProc (void *ptr, ASSize_t size, ASSize_t count, MDFile f, ASInt32 *pError)
*pError = 0;
if ( ptr == NULL )
  return 0;
DWORD dwRemaining = dwDataSize - dwDataIndex;
DWORD dwReadSize = min( dwRemaining, (DWORD)( size * count ) );
CopyMemory(ptr, &lpBuffer[ dwDataIndex ], dwReadSize );
dwDataIndex += dwReadSize;
return (ASSize_t)dwReadSize;
static ACCB1 ASSize_t ACCB2 MyASFileSysWriteProc (void *ptr, ASSize_t size, ASSize_t count, MDFile f, ASInt32 *pError)
return 0;
static ACCB1 ASInt32 ACCB2 MyASFileSysRemoveProc (ASPathName pathName)
return 0;
static ACCB1 ASInt32 ACCB2 MyASFileSysRenameProc (ASMDFile* f, ASPathName oldPath, ASPathName newPath)
return 0;
static ACCB1 ASBool ACCB2 MyASFileSysIsSameFileProc (ASMDFile f, ASPathName pathName, ASPathName newPathName)
return 0;
static ACCB1 ASInt32 ACCB2 MyASFileSysGetNameProc (ASPathName pathName, char *name, ASInt32 maxLength)
return 0;
static ACCB1 ASInt32 ACCB2 MyASFileSysGetNameAsASTextProc (ASPathName pathName, ASText name)
return 0;
static ACCB1 ASPathName ACCB2 MyASFileSysGetTempPathNameProc (ASPathName pathName)
return (ASPathName)PDF_MEMORY_FILESYS;
static ACCB1 ASPathName ACCB2 MyASFileSysCopyPathNameProc (ASPathName pathName)
return (ASPathName)PDF_MEMORY_FILESYS;
static ACCB1 char * ACCB2 MyASFileSysDiPathFromPathProc (ASPathName path, ASPathName relativeToThisPath)
    return NULL;
static ACCB1 ASPathName ACCB2 MyASFileSysPathFromDIPathProc (const char * diPath, ASPathName relativeToThisPath)
return (ASPathName)PDF_MEMORY_FILESYS;
static ACCB1 void ACCB2 MyASFileSysDisposePathNameProc (ASPathName pathName)
static ACCB1 ASAtom ACCB2 MyASFileSysGetFileSysNameProc (void)
return NULL;
static ACCB1 ASUns32 ACCB2 MyASFileSysGetStorageFreeSpaceProc (ASPathName pathName)
return INT_MAX;
static ACCB1 ASInt32 ACCB2 MyASFileSysFlushVolumeProc (ASPathName pathName)
return 0;
static ACCB1 ASPathName ACCB2 MyASFileSysCreatePathNameProc (ASAtom pathSpecType, const void *pathSpec, const void *mustBeZero)
return (ASPathName)PDF_MEMORY_FILESYS;
static ACCB1 ASInt32 ACCB2 MyASFileSysGetItemPropsProc (ASPathName pathName, ASFileSysItemProps props)
return 0;
static ACCB1 ASFolderIterator ACCB2 MyASFileSysFirstFolderItemProc (ASPathName folderPath, ASFileSysItemProps props, ASPathName *itemPath)
return NULL;
static ACCB1 ASBool ACCB2 MyASFileSysNextFolderItemProc (ASFolderIterator folderIter, ASFileSysItemProps props, ASPathName *itemPath)
return 0;
static ACCB1 void ACCB2 MyASFileSysDestroyFolderIteratorProc (ASFolderIterator folderIter)
static ACCB1 char * ACCB2 MyASFileSysURLFromPathProc (ASPathName path)
return NULL;
static ACCB1 ASPathName ACCB2 MyASFileSysGetParentProc (ASPathName path)
return NULL;
static ACCB1 ASInt32 ACCB2 MyASFileSysCreateFolderProc (ASPathName path)
return 0;
static ACCB1 ASInt32 ACCB2 MyASFileSysRemoveFolderProc (ASPathName path)
return 0;
static ACCB1 char * ACCB2 MyASFileSysDisplayStringFromPathProc (ASPathName path)
    return NULL;
static ACCB1 void ACCB2 MyASFileSysSetTypeAndCreatorProc (ASPathName path, unsigned long type, unsigned long creator)
static ACCB1 void ACCB2 MyASFileSysGetTypeAndCreatorProc (ASPathName path, unsigned long *type, unsigned long *creator)
static ACCB1 ASInt32 ACCB2 MyASFileSysAcquirePlatformPathProc(ASPathName path, ASAtom platformPathType, ASPlatformPath *platformPath)
return 0;
static ACCB1 void ACCB2 MyASFileSysReleasePlatformPathProc(ASPlatformPath platformPath)
//write the following code in your open PDF file procedure
FileSize = //size of your PDF File;
lpBuffer = (char *)malloc(FileSize);
PDDoc pdDoc = PDDocOpen( (ASPathName)PDF_MEMORY_FILESYS, &MyFileSys, NULL, true );
ASFile asFile = PDDocGetFile(pdDoc);
ASText title = ASTextFromScriptText ("PDF File Name",kASRomanScript);
AVDoc targetDoc = AVDocOpenFromASFileWithParams (asFile, title, NULL);
//Thanks

Similar Messages

  • Can I convert PDF to PPT using adobe acrobat x standard? If so, how?

    Can I convert PDF to PPT using adobe acrobat x standard? If so, how?

    Hi meganl52100253,
    With Acrobat X, you can save to Word and Excel format by choosing File > Save As. But saving to PowerPoint wasn't introduced until Acrobat XI.
    You're welcome to try Acrobat if you'd like. You can download a free 30-day trial from http://www.adobe.com/products/acrobat.html.
    Best,
    Sara

  • Why does all alphabets change to capital when converting pdf to word using Adobe Acrobat XI

    Why does all alphabets change to capital when converting pdf to word using Adobe Acrobat XI

    Word 2013 uses its own pdf creator engine as far as I know. The step I performed were:
    1 - In the save settings I told word to embed fonts (sorry for the language, I have the Italian client)
    2 - Export from Word -> Save As -> .pdf adding also the table of contents/index
    N.B. I cannot use PDF/A, and in any case it doesn't embed the font
    A working solution is to use Acrobat XI to convert it or print with Adobe PDF printer, results:
    The problems are 2:
    1 - It doesn't create any bookmark and doesn't create links from the table of images to the linked images
    2 - Images, also with the preset "High Quality Printing" customized using "No compression", are really ugly and if you zoom a bit more than 100% they totally be s**t. It wasn't that way with PDF created by word.
    In the end, or I find they way to open the pdf created by word and embedd the missing font, or I find a way to make Acrobat XI creating bookmarks from the word file.
    Suggestion?

  • Loading PDFs from memory

    Hi,
    I'm using PDFLib 8.1 to open PDF documents for creating PNG previews. Using some example code I've successfully created preview images from PDF documents on my file system. What I would like to do is be able to do exactly the same, however the PDF document are stored in a memory buffer.
    I understand from reading similar queries that I need to create my own ASFileSys (and/or ASFile) to implement reading from memory. Can anyone help point me in the right direction for doing this please? Has anyone done anything similar to this? Any code snippets that anyone has will be greatly appreciated.
    Many thanks,
    Alan.

    Hi,
    Thanks for your reply.
    I don't seem to be able to find any ASFileSys samples / skeletons so I'm fighting this problem in the dark :(
    I have instantiated a new ASFileSysRec as follows...
    ASFileSysRec pdfMemoryFileSys;
    memset( &pdfMemoryFileSys, 0, sizeof( ASFileSysRec ) );
    pdfMemoryFileSys.size = sizeof( ASFileSysRec );
    pdfMemoryFileSys.open = OpenMemory;
    pdfMemoryFileSys.close = CloseMemory;
    pdfMemoryFileSys.flush = FlushMemory;
    pdfMemoryFileSys.setpos = SetPosMemory;
    pdfMemoryFileSys.getpos = GetPosMemory;
    pdfMemoryFileSys.seteof = SetEofMemory;
    pdfMemoryFileSys.geteof = GetEofMemory;
    pdfMemoryFileSys.read = ReadMemory;
    ...etc
    (a very laborious task to implement each callback!)
    and I have got as far as ASFileSysCreatePathName working (calls pdfMemoryFileSys.createPathName) and I even see SetPosMemory / ReadMemory / etc being called from PDDocOpen (I simply return the required memory buffer position from a global buffer).
    However I get all sort of problems (exceptions thrown) - I'm pretty sure I'm returning the correct buffer contents/seek positions, etc. I have noticed the following callback functions...
    pdfMemoryFileSys.firstFolderItem (ASFileSysFirstFolderItemProc)
    pdfMemoryFileSys.nextFolderItem (ASFileSysFirstFolderItemProc)
    ...etc
    I've no idea what to return in these callbacks (?).
    It's very frustrating, I don't believe I'm asking for anything too out of the ordinary by wanting to load a PDF from memory instead of a file!
    I'm hoping that someone will tell me I'm crazy to be doing what I'm doing and that there's a much simpler way (?!).

  • Create pdf using Adobe acrobat sdk

    Hello,
    I'm new to this concept of using adobe sdk to convert a html into pdf.I would like to know few details regarding this..
    I went thorugh the documentation but I did not get any help about the vector image support in the pdf and I aslo want to know abot the dpi support in the pdf.
    I also want to know wether I can create a pdf form a Html page.
    thanks for the help.

    >I want this to be on the server.
    Ok, we can start there - or stop. The Acrobat SDK is for automating
    Acrobat. Acrobat must not be installed on a server. So you cannot use
    Acrobat.
    Adobe have a PDF Library, which can be licensed for server use. But it
    does not have any easy HTML to PDF converter.
    You might look into LiveCycle PDF Generator, a different application
    with a Java API and more, for server use.
    >The dpi what I was talking about was..in the pdf i want a logo to appear that would around 200-300 dpi.That logo is a vector image.
    This seems a contradiction. PDF files can store text, vector images
    and bitmaps/images. If you store a vector image, it remains vector and
    there is no dpi to worry about.
    HOWEVER if you can only convert HTML
    1. HTML does not support any vector formats
    2. HTML often forces images to 72 dpi.
    HTML is not suitable for print quality.
    Aandi Inston

  • Firefox 8... Unable to create PDF files from screen using Adobe Acrobat X...what happened?

    I'm no longer able to use the Adobe feature to create PDF's from the Firefox screen.
    Unable to find any information on correcting this issue.
    I would not have upgraded to Firefox 8 if I knew the loss of the Adobe PDF feature would be effected.
    I reinstalled the standard Adobe Acrobat X with no results...
    What happened?

    Firefox Support - I even create a Firefox account just to agree with [email protected] I appreciate the word "Thank you for being awesome!" when I registered the account and I certainly do hope you all guys being awesome to. Please do something with all this Firefox update - add-on plugin no longer support thingy. Firefox still awesome, it's just that I can't do much wit it anymore like I used to do. Ohh yayy theres Safari..

  • Can I use Adobe acrobat SDK for commercial products of our company.

    Hi Adobe guys,
    One of our new project need to  print a pdf file (Application form) from local computer. So I'm looking for some API to print PDF files and I heard about acrobat SDK provide by Adobe. So my question is can I use this SDK for our companey commercial product development?

    Sure.
    Of course, the user will need to have either Acrobat or Reader installed – depending on which APIs you choose to use.

  • Problem in creating PDF of Website using Adobe Acrobat Professional 8.

      I am trying to create PDF file of full website using "Create PDF from Web Page..." option, in Adobe Acrobat Professional 8.
    It is creating PDF but the page alignments/text/images alignments are lost and doesn't look good.
    Can any one help to create the PDF same as webpage look and feel.
    Thanks.

    Acrobat 8's HTML->PDF engine is quite old and doesn't work well with modern web pages. I'd recommend trying the same page using Acrobat X (trial available) where the engine has been replaced and modernized.

  • Will not print priority mail labels from USPS using Adobe Acrobat 10.0.1.434 and Windows XP

    I click on pay and print and PDF does not load or bring up print function box for my printer. Screen says it's done but no label is there. I have successfully used Mozilla until most recent update [3.6]. Now I have to use IE or Chrome on the USPS site to print out the labels. I contacted USPS and they suggested deleting McAfee which downloads with Adobe Acrobat Reader 10.0.1.34. I tried to remove the McAfee program (even by downloading the uninstaller and XP add/remove programs cannot delete it. HELP! Thanks.

    I have found another possible bug affecting network printing with 10.1.2 in Protected Mode on XP SP3 machines that has not been previously documented:
    A number of users in one office were not able to print with 10.1.2 in Protected Mode (even with the printing hotfix/patch previously released) to their default printer; however they were able to print fine with 10.0.1 in Protected Mode OR by disabling Protected Mode in 10.1.2.  They could print to Microsoft XPS Document Writer, however.
    The cause was determined to be an issue with capitilization of the printer name in the registry!  10.1.2 in Protected Mode seems to be sensitive to this for some strange reason, though other apps don't care.
    Check the following keys and ensure the capitalization of any references to name of your printer (or UNC path of the printer share) is consistent:
    HKCU\Printers\Connections
    HKCU\Printers\Settings
    HKCU\software\microsoft\windows nt\currentversion\windows\Device
    In our case, the reference to the name of the default printer was in lowercase, while the printer path recorded under settings was in UPPERCASE.   Changing this to match immediately fixed the problem.

  • Failure to Open PDFs from the web - 'Adobe Acrobat has crashed'

    I can't download pdfs from the internet, for instance an exam paper.
    Chrome tells me 'Adobe Acrobat has crashed'
    I'm using Windows 7, any ideas what I can do to fix this?

    Hi PLAVERY798
    Temporary fix:
    --Go to Chrome plugins page by typing this in your browser: chrome://plugins/
    --Look for "Chrome PDF Viewer" and Enable it
    Otherwise, Please Use any Other browser like , Firefox or Internet explorer !

  • How do I get print to PDF to install using Adobe Acrobat 7 on a 64 bit computer

    I just got a new computer at work and installed CS2 with Adobe Acrobat 7.  An error popped up during installation saying that the Print to PDF function does not work.  Is there a way to fix this?  I looked through the discussions and there was not a document port under add printer.  Thanks for the help.

    Hi Matt,
    Acrobat 7 PDFMaker will not work on Windows 7 64 bit as it's not tested and there might be compatibility issues.

  • Print PDF from web with adobe acrobat 8

    I have adobe acrobat standard version 8.
    The program works fine, except I can not print a web page to a PDF.
    Under the print option, there is no longer a tab/printer option that says print to adobe PDF?
    How do I get that back?

    No.  It is not there for some reason, and I can't see how to install it?

  • Converting PDF to excel using Adobe Acrobat Pro XI

    I am trying to convert long but simple PDFs to excel but I keep getting an error message. I have tried disabling OCR, but nothing. Some of my files are rather large, but smaller than 100MB. Any suggestions?

    Hi Sara,
    I'm working on an Imac 3.2GHz Intel Core i5 running OS X 10.9.5. Sometimes
    Acrobat just shuts down, sometimes it stops responding and I have to force
    quit, and other times I get this message: "Save as failed to process this
    document. No document was created".
    I don't know exactly how the PDFs were created, as they come from another
    institution. They look as if they were exported from excel though. The
    thing is I have several files, all with the same structure, from the same
    source, and the small ones were converted without a problem, but the large
    ones simply won't. I'm attaching one of the files, perhaps you can see for
    yourself something useful.
    Thanks,
    Mariana
    On Tue, Nov 11, 2014 at 7:34 PM, Sara.Forsberg <[email protected]>

  • How do I un-check the box "Display PDF in browser" using Adobe Acrobat Pro (9.0.0)?

    It is faded out and not allowing me the option.

    First of all, update your Acrobat to the latest version available for 9.
    Then, if you have Windows 8 it might still not be enough, as the two are
    not compatible.
    On Fri, Jan 23, 2015 at 7:07 AM, roxanne tollman <[email protected]>

  • Viewing PDF Portfolio using Adobe Acrobat XI Pro in Sharepoint Foundation 2013

    When opening a PDF Portfolio, created using Adobe Acrobat XI Pro, in Sharepoint Foundation 2013 the pages are blank in the default Layout view but you can see the contents in File view. How do we correct that so the files appear in both views? Local IT stated it is an ADOBE problem.

    [discussion moved to Creating, Editing & Exporting PDFs forum]

Maybe you are looking for

  • JDBC TO RFC SCENARIO

    Hi, I am tryiing JDBC TO RFC SCEANRIO. XI is picking data from MS SEQUEL SERVER but the same data is not getting mapped into RFC   I am not getting any error as such. Following are the details. made a datatype resultset      row      EmployeeID     

  • Issue in PDF export from InDesign CS4

    Hi, We are facing one issue while creating  PDF file from the InDesign document. The document has 2-column texts created in InDesign CS4 application. The issue is, we export the PDF from InDesign document. When we open the PDF in Acrobat and selectin

  • External allications on navigation bar ...urgent

    I want to have all my external applications.. on my navigation bar in my content area, so that they can be accessed on the same page along with other folders. How should I do it?

  • I have a macbook pro.How do I stop the color wheel from spinning?

    I have a macbook pro.How do I stop the color wheel from spinning? I can not get the computer to shut down w/out doing a force quit.

  • Message from Page procedure

    Hi All, I am calling multiple procedures on Submit button(Page processing) and on the basis of the data passed to procedures getting error/success messages as out parameter. I need to display these error messages on the page. How could I do this? Tha