Click here to Skip to main content
15,070,613 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,

I have current requirement where i need to convert images stored on my local machine to pdf and save that pdf in same folder, and i need javascript snippet for that.
Please help me with this as i am struggling from so long.
If u have solution using Dynamic web twain its ok..
i can use it... as i have already used it for converting scanned copies to images on my local machine.
Thanks in Advance
Posted
Comments
bbirajdar 29-Mar-13 8:00am
   
Reuse the solution you already have.. Why are you looking for something new ?
sunil mali 29-Mar-13 8:06am
   
i am not looking for anything new sir, i used dynamic web twain for saving images to my local machine, now i want those saved image to be converted into pdf, Converting saved images to pdf feature is not there in dynamic web twain. Thats why i am looking for some javascript snippet for this....
ZurdoDev 29-Mar-13 8:16am
   
Javascript is not the right technology for this simply because it cannot access the client's hard drive. You might want Java or something else.
sunil mali 29-Mar-13 8:52am
   
Javascript is the only way using which we can access client's drive... Because javascript is client side library...
i have found one links like
https://www.bytescout.com/products/developer/pdfgeneratorsdkjs/index.html
but i am not able to use it, because i am not able to understand where to start....

I know i can achieve it, as whatever doubts i had till this date i have solved everything...At the end of this blog definately i have one or other way to achieve this...
just looking for someone right who can answer....
Prasad Khandekar 29-Mar-13 17:56pm
   
Hello Sunil,

You have found the product, but did not bothered to look the samples provided on the site. Please look at the sample especially (https://www.bytescout.com/products/developer/pdfgeneratorsdkjs/create_pdf_text_images_lines.html[^]). Do remember that this library is free for non-commercial use only.

1 solution

Hii prasad,
They have given this function, but i don't know how to read pdf created by this function by my frame.
see it returns pdf object i want to read this pdf object through my frame.
See if u can help with this.

C#
function CreatePDF() {

    // create BytescoutPDF object instance
    var pdf = new BytescoutPDF();

    // set document properties: Title, subject, keywords, author name and creator name
    pdf.propertiesSet("Sample document title", "Sample subject", "keyword1, keyword 2, keyword3", "Document Author Name", "Document Creator Name");

    // set page size
    pdf.pageSetSize(BytescoutPDF.Letter);
    // set page orientation
    pdf.pageSetOrientation(true);

    // add new page
    pdf.pageAdd();

    pdf.fontSetName('Helvetica');
    pdf.fontSetStyle(false, false, false);

    for (var i = 0; i < 5; i++) {
        pdf.fontSetSize(10 + i * 4);
        pdf.textAdd(20 + 70 * i, 20, 'hola');
    }

    pdf.fontSetStyle(false, true, true);
    pdf.textAdd(50, 50, 'hello');
    pdf.fontSetStyle(true, true, true);
    pdf.textAdd(250, 50, 'hello');

    pdf.pageSetOrientation(false);
    pdf.pageAdd();

    pdf.fontSetName('Times-Roman');
    pdf.textAdd(20, 70, 'hello');
    pdf.fontSetStyle(true, false, true);
    pdf.textAdd(100, 70, 'hello');
    pdf.fontSetStyle(false, true, true);
    pdf.textAdd(190, 70, 'hello');
    pdf.fontSetStyle(true, true, true);
    pdf.textAdd(280, 70, 'hello');

    pdf.fontSetName('Courier');
    pdf.textAdd(20, 90, 'hello');
    pdf.fontSetStyle(true, false, false);
    pdf.textAdd(100, 90, 'hello');
    pdf.fontSetStyle(false, true, false);
    pdf.textAdd(190, 90, 'hello');
    pdf.fontSetStyle(true, true, true);
    pdf.textAdd(280, 90, 'hello');

    for (var j = 0; j < 50; j++) {
        pdf.graphicsSetColor(j * 5, 0, 250 - j * 5);
        pdf.graphicsSetLineWidth(1 + j / 25);
        pdf.graphicsDrawLine(20, 120 + j * 4, 120, 120 + j * 4);
    }

    pdf.textAdd(200, 150, 'hello');

    pdf.pageSetOrientation(true);
    pdf.pageAdd();

    pdf.imageLoadFromUrl('image1.jpg');
    pdf.imagePlace(20, 40);

    pdf.imageLoadFromUrl('image2.jpg');
    pdf.imagePlace(120, 220);

    // return BytescoutPDF object instance
    return pdf;
}
   
Comments
sunil mali 30-Mar-13 2:40am
   
Also if you have any product, which i can use for non commercial purpose... Your suggestions are always welcome..

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900