Could somebody provide me with example how I can pass file stream to PDF file as attachment?
/*code begins*/
pdDoc = PDDocOpenEx(pathMainFile, ASGetDefaultFileSys(), NULL, NULL, FALSE);//open mainPDF - all OK
ASFixedRect rcAnnot = {fixedZero, fixedZero, fixedZero, fixedZero };
pdPage = PDDocAcquirePage( pdDoc, PDDocGetNumPages( pdDoc ) - 1 );
pdAnnot = PDPageAddNewAnnot( pdPage, -2, ASAtomFromString("FileAttachment"), &rcAnnot );
PDAnnotSetTitle( pdAnnot, "SomeTitle", 9 );
//annotation created - all works fine.
ASFileSysOpenFile( NULL, pathAttachment, ASFILE_READ, &fileAttachment );
stmAttach = ASFileStmRdOpen( fileAttachment, 0 );
cosStmAttach = CosNewStream( cosDoc, true, stmAttach, 0, false, CosNewNull(), CosNewNull(), -1 );
ASStmClose( stmAttach );
/*code ends*/
The main question is following: What should I do next after opening Cos file stream? Because PDF specification is to blurred for me in this aspect. As I understand I should create some dictionary entries - but I can't understand what entries should be created(even their names differ in different part of specification) ad where they should be created in.
Help me, please.
/*code begins*/
pdDoc = PDDocOpenEx(pathMainFile, ASGetDefaultFileSys(), NULL, NULL, FALSE);//open mainPDF - all OK
ASFixedRect rcAnnot = {fixedZero, fixedZero, fixedZero, fixedZero };
pdPage = PDDocAcquirePage( pdDoc, PDDocGetNumPages( pdDoc ) - 1 );
pdAnnot = PDPageAddNewAnnot( pdPage, -2, ASAtomFromString("FileAttachment"), &rcAnnot );
PDAnnotSetTitle( pdAnnot, "SomeTitle", 9 );
//annotation created - all works fine.
ASFileSysOpenFile( NULL, pathAttachment, ASFILE_READ, &fileAttachment );
stmAttach = ASFileStmRdOpen( fileAttachment, 0 );
cosStmAttach = CosNewStream( cosDoc, true, stmAttach, 0, false, CosNewNull(), CosNewNull(), -1 );
ASStmClose( stmAttach );
/*code ends*/
The main question is following: What should I do next after opening Cos file stream? Because PDF specification is to blurred for me in this aspect. As I understand I should create some dictionary entries - but I can't understand what entries should be created(even their names differ in different part of specification) ad where they should be created in.
Help me, please.