Need to create a pdf file programmatically

Hi friends,
      I am able to read contents of a pdf file in KM repository programmatically. Now I am trying to create a pdf file programmatically. I ve tried the following solutions:
1) <b>pdfwriter</b>. Here i endup with giving the path for the file.I ve tried giving RID and URL of the document. but in vein.
2) <b>createresource</b>. Here i am able to create a txt file. but couldnt find how to create pdf.
Awaiting replies specific to the questions. thanks in advance.
Regards,
Saravanan

Hi Saravanan,
In my view,the solution for this is to create a pdf file in C or any drive of the sever temporarily and get the FileInputstream from that temporary file and with the file stream upload pdf file in to KM repository and finally delete the temporary file u have created.
Follow the code given,it will be more clear
//Creating PDF
Rectangle pageSize = new Rectangle(0,0,2382,3369);
Document document = new Document(pageSize);
try {
PdfWriter.getInstance(document, new FileOutputStream("<b>D:\PDFfromJava.pdf</b>"));
  document.open();
  document.add(new Paragraph("Hi, this is demo PDF file from JAVA!"));
catch(DocumentException de) {
  response.write("Document Exception");
}catch(IOException ioe) {
response.write("IO Exception");
ResourceContext rContext=null;
ICollection aCollection=null;
IResource aResource=null;
InputStream myIS=null;
IUser loggedOnUser = (IUser) request.getUser().getUser(); if (loggedOnUser.isAuthenticated()) {
rContext = new ResourceContext(loggedOnUser);
RID aRid = RID.getRID("/documents"); // remember that the repository is case sensitive
try {
IResourceFactory aResourceFactory = ResourceFactory.getInstance();
aCollection = (ICollection) aResourceFactory.getResource(aRid, rContext);
//Creating a File object
File myPDF=new File("<b>D:\PDFfromJava.pdf</b>");
//Getting the stream from temp file
myIS=new FileInputStream(myPDF);
IContent aContent = new Content(myIS,"byte",-1);
if (aCollection != null)
aResource = aCollection.createResource("<b>PDFfromJava.pdf</b>", null, aContent);
myIS.close();
//deleting the temp file from server
myPDF.delete();
}catch(Exception e){
     response.write("Exce"+e);
<b>One more thing the file name PDFfromJava.pdf mentioned in bold should be same at all places</b>

Similar Messages

  • How can I create multiple PDF files from multiple InDesign files?

    I have 144 InDesign files that I need to create a PDF file for each. I do not want to open each InDesign file to create the PDF's. Acrobat Batch create won't open the InDesign files. Is there another way?

    Only InDesign can do this. You may want to look at InDesign automation.

  • How do I create a pdf file of some iPhoto pictures

    I deal with some client servers that will not allow embedded pictures in email message to pass through their firewall.  So, I need to create a pdf file of some of my iPhoto pictures to send as an email pdf attachment.  Can anyone help?  I'm at a loss in trying to accomplish this.  I have an iMac 27" running OS X 10.9.4 and iPhoto '09 version 8.1.2.

    Use Pages (word processor) to put/arrange your images. Once done, save the document as a PDF file and attach it to your outgoing mail. 

  • Image Policy when I create a PDF file: warn and continue doesn't work

    Hi!
    I need to create a PDF file with lots of images, and I need to know if any of that images is in low resolution (<300 ppi). I have tried to use the image policy in the PDF settings but it doesn't work, because if I choose "Warn and continue" (if the resolution of any image is <300 ppi, warn and continue) the program creates the PDF file but don't warm me and I don't see any message... and I'm sure that there are bad images because I have made a check test with 72ppi images.
    Thank you very much for your attention,
    best regards!!
    (Sorry if my English is not as good as it would be)

    Thank you very much Bernd Alheit, that's perfect for my job!
    Thank you!

  • I already typed this in but here I go again:   Need to convert a pdf file right away.  Have not used my account for a while but is still open.  I used to have no trouble.  What has happened?

    this is the 3rd time I have typed this message.  I have an account but am not able to create a pdf file, need it right away and used to not have trouble.

    Hi touser,
    Can you please provide some specifics about the problem you're encountering? Do you get an error message, or does the file conversion process never complete? Is the problem specific to one file, or occur with every file you try to convert?
    Please help fill in the blanks for us, so we know best how to help you resolve this issue.
    Best,
    Sara

  • I need to create a PDF from InDesign that people can edit in Reader or Acrobat

    I need to create a PDF from InDesign that people can edit (for example, change a name from "John" to "Johnny") from either Adobe Reader or Adobe Acrobat. I have already looked at forms, but they do not keep your font colors, faces, and sizes and just make everything that is selected as a text form Black, 12pt, Times New Roman.
    Can anyone here help me?

    Vincent,
    If you use Acrobat pro, generate your .pdf file and then save it as (french version):
    ... so that anyone using Acrobat Reader (or Pro, of course) can modify the .pdf file (with limitations), add comments, ...
    If you want to try to "protect" your .pdf file, you can try with this (in the "Préférences" menu (french version)):

  • How to create a pdf file from multiple images ?

    Dear All,
    I want to create a SINGLE page pdf file from two or more page size images that are combined to make a single page pdf. Again, this question is on pdfs that are made out of several, atleast  two color images and a black-and-white mask for one of them.
    I have such pdf files from an unknown source (the producer is edited out) whereby there are three tiff images, obtained using the well known pdfimages extractor.
    When I want to make a pdf out of tiff or png or other image formats, I right click and tell Adobe Acrobat to make a pdf.
    However, I dont know how I can give a command to select say,  three tif images and specify which is the mask for which and then join  them in a way that I get the pdf from the composite of the two color images and a mask for one of them.
    Please help me out.
    I am a little familiar with the pdf structure skeleton and when necessary, fixed xref tables in one of my favorite editors. A few years ago, I also wrote a bunch of javascripts to make some annotations and needed some automation and used some itext type libraries. However, I need your help in this problem as I am now rusty and forgot some of what I studied to solve my earlier problems. This is a new problem for me. Gentle hints from you would be very nice to help me in this problem. Please specify if necessary what manual and pages to read. in the pdfspec.
    Best Regards
    Disabled Veteran [physically handicapped]

    Hello Again.
    On Fri, May 11, 2012 at 12:20 PM, lrosenth <[email protected]> wrote:
    >
    > Re: How to create a pdf file from multiple images ?
    >
    > created by lrosenth in PDF Language and Specifications - View the full
    > discussion
    > ________________________________
    >
    > No clue who Irving is…
    >
    I was hoping to have your first name so its easy for me to address you.
    > I have no clue what OS platform, programming language, etc. you use so
    > can’t really narrow things down.
    I would gladly mention that I am working on windows platform, preferably XP.
    I can also work on linux for free products that come with it.
    >  Also, as this is an Adobe forum, we only
    > recommend Adobe products – so there may be other options that even my list
    > wouldn’t include.
    But adding other products, for the help of an adobe products user,
    even if it outside adobe, shall add greater prestige to your company
    and give impression of user-centeredness.
    > If you read ISO 32000-1:2008 (aka the PDF standard), you will find the
    > information about Images and Image Masks well described.  I didn’t think I
    > needed to repeat any of that information.
    Well, just add the few pdf stanzas since you are proficient on it and
    I am presently a little rusty as I mentioned. Just asking a little
    extra yard, not even to go an extra mile.
    > And, if you read that same document, you will see that there is NO SUCH
    > THING as a “text only PDF”.   All PDF documents are structured binary files.
    Well, ascii format or uncompressed format that is human readable. I
    know its a binary file, but human readable ascii version of it.
    I hope you can give me some stanza and various other approaches
    possible so I can select or combine things for myself. I see only a
    miniscule number of posts claiming to have written masks in this forum
    and then with no details.
    Regards
    Roger
    Message was edited by: dying veteran
    because the adobe posting system went crazy and truncated all except the first line ... dunno why

  • How to create a pdf-file dynamically

    Hi all,
    does anybody have a tutorial or self-made code, in which is illustrated, how to dynamically create a pdf-file.
    I am getting some information like this: "Line one has a textfield and an input-field", etc. These informations have to be translated as a pdf-file by myself.
    I read, that a pdf-file needs a xdp and the data as an inputstream. Is there anybody who can explain this issue?
    I think, that there are a lot of people, who are interested in this problem.
    Thank you for your help.
    Kind regards, Patrick.

    check this link...
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/lw/uuid/10b33628-0207-2a10-908f-de9c02ca6913
    hope it helps.
    regards,
    -amol gupta

  • How to create a pdf file?

    Hi,
    I would like to know how to create a pdf file programatically using APIs. I have acrobat8 or acrobat9 sdk but there no dll in sdk.
    Do i need acrobat library? If yes then how to get the same?

    You need Adobe Acrobat.
    The Acrobat SDK is automating/programming Acrobat (and sometimes Reader).

  • I want to create a Pdf file - do i misunderstand the product?  I thought i could create a PDF similar to excel or word file or do i have to create there and convert to PDF? I bought the pack for $89.PDF Pack!

    I want to create a Pdf file - do i misunderstand the product?  I thought i could create a PDF similar to excel or word file or do i have to create there and convert to PDF? I bought the pack for $89.PDF Pack!

    Hi Brian,
    You can create it in Word or excel and then you can Convert it into .pdf Format
    Here's a feature list that depicts benefits of PDF pack: Convert Word to PDF, Convert PDF to Word & Merge PDFs | Adobe PDF Pack
    Please revert back if you have any other questions or need any help.
    Regards,
    Rahul

  • Export to PDF - Can a single report (rpt file) create multiple PDF files using the export command?

    Post Author: markeyjd2
    CA Forum: Exporting
    Greetings forum members,
    My question is, in its entirety: Can a single report (rpt file) create multiple PDF files using the export command, ideally one PDF file per DB record?
    In my case; I have a Crystal Report that reads data from a DB table containing ~ 500 records.  When I export the report to a PDF file, I get one PDF file, with ~ 500 pages.
    What I would like to do is export the report to ~ 500 individual PDF files; One file per DB record.  The file names would be based on the table's primary key.
    Is this possible?

    Post Author: Micha
    CA Forum: Exporting
    Hi,
    you need some lines of code, but its easy. Dependend on how to start the generation of your 500 PDFs, you can write an ASP page and start it via Web Browser, or a Windows Script and start it via scheduled job...
    Here's an abstract of the ASP code I use:
    First, you create a recordset (here: "rsc") which gives you the list of ID fields you want to export, then you create CrystalRuntime.Application object, then you loop through the recordset, open your report (here: "oRpt") and set login info. Then set the selectionformula, so that the report displays only the data of the current ID, e.g.:
      oRpt.RecordSelectionFormula = "(" & oRpt.RecordSelectionFormula & ") AND {myTab.myVal}=" & rsc("myVal")
    Then you export the report, move to the next record in recordset, and repeat the loop until recordset.EOF. Then you close recordset and connection.
    Micha

  • Creating a PDF-file with CONVERT_OTF. How to set the properties?

    Gents, Ladies,
    I have an ABAP that uses CONVERT_OTF and creates a pdf-file. This works fine but now the security properties of the pdf-file need to be set to not-modifiable (See File, Document Security in Acrobat's Reader).
    Can any of you help me to set any of the properties of the pdf-file?
    Best regards,
    Tim van Steenbergen.

    Hi tim,
    sorry, it's not possible (see Steff's posting)
    http://www.abapforum.com/forum/viewtopic.php?t=318&highlight=pdf
    grx
    Andreas

  • Distiller will not create a .pdf file

    Yesterday, I noticed—out-of-the-clear-blue-sky— that whenever I tried distilling a layout file in .eps, I kept getting 'Error' messages whenever I tried Distilling anything and Distiller wouldn't create a .pdf file!
    This is what I recieved.
    %%[ Error: undefined; OffendingCommand: MMXPR3 ]%%
    %%[ Flushing: rest of job (to end-of-file) will be ignored ]%%
    %%[ Warning: PostScript error. No PDF file produced. ] %%
    Distill Time: 0 seconds (00:00:00)
    **** End of Job ****
    I even tried using an .eps file that I had created a .pdf file, from Distiller, on the previous day, and that wouldn't work either. So whats going on?
    I finally got fed up and just uninstalled Acrobat and Distiller, and reinstalled it, and that didn't work either. My Acrobat also won't manually update now. I keep getting a "Update Internal Error." This also kept happening after I reinstalled it.
    I need to use my Distiller in order to get a Press Quality .pdf.
    I'm operating on a Mac OS X 10.5.8
    I'd appreciate any help I can get.
    Melodie

    Sounds like an EPS with preview? Not suitable. Use postscript for printing, not EPS.

  • Using reports to "just" create a pdf file

    Hi All,
    I'm using oracle aplication server 10g.
    I have a situation where i must send several emails into my clients. I want to use the reports server to create several pdf files attached into a "pretty" mail message.
    In the end the user will get a full report in a "pretty" html message with several pdf files.
    I have already done a very flexibal pl/sql procedure that can send emails into any mail server and using any amount of attach files.
    I have already done the reports and i can call them find from the find from oracle forms creating a pdf file.
    My problem is that i can't stop the oracle from calling the browser and showing the report on the user screen. I simple want to generate the reports... create a html email message attach the reports (pdf) and send them into the user
    Using the build in email support in oracle reports is out of the question because it's a bit limited.
    Any help would be great.

    Hi,
    Thanks a lot for your reply.
    But i do not want to use reports to send the email, i just want him to generate a pdf file and NOT OPENING the pdf file on the user browser, having that i will use my own pl/sql procedure to send the email with the pdf file attached.
    I need this because because reports is a bit limit in the email respect, and with a build in email procedure i can do a lot more things (mail queues, elaborate messages, mail store etc)
    PS: i'm using the rp2rro.rp2rro_run_product package to run the reports
    Miguel Angelo
    Message was edited by:
    [email protected]

  • Read contents inside pdf file programmatically in SharePoint

    I have a SharePoint document library, My Requirement is when user add PDF file on the document library the event receiver fire and read contents inside
    pdf file programmatically. After the start workflow according to the result of event receiver.

    If your question is about handling events in apps for SharePoint, see these links:
    http://msdn.microsoft.com/en-us/library/office/jj220048%28v=office.15%29.aspx
    http://msdn.microsoft.com/en-us/library/office/jj220051%28v=office.15%29.aspx
    If what you need is a way to extract text from the PDF inside the event handler, see this example that uses leadtools.
    http://support.leadtools.com/CS/forums/ShowPost.aspx?PostID=43894
    You should use PDF text extractor in your Event Handler code -
    You can use iTextSharp for reading content
    http://www.codeproject.com/Tips/387327/Convert-PDF-file-content-into-string-using-Csharp

Maybe you are looking for