将本地计算机上的图像转换为pdf并将其保存在本地计算机的同一文件夹中 [英] Convert Images on local machine to pdf and save it on local machines same folder

查看:64
本文介绍了将本地计算机上的图像转换为pdf并将其保存在本地计算机的同一文件夹中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我有当前的要求,我需要将我本地机器上存储的图像转换为pdf并将pdf保存在同一个文件夹中,我需要javascript片段。

请帮我这个,因为我很长时间没有挣扎。

如果你有使用Dynamic web twain的解决方案那就好了..

i可以使用它...因为我已经用它将扫描副本转换为本地机器上的图像。

先谢谢

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

推荐答案

Hii prasad,

他们已经提供了这个功能,但我不知道如何通过我的框架阅读这个函数创建的PDF文件。

见它返回pdf对象我想通过我的框架阅读这个pdf对象。

看看你是否可以帮忙解决这个问题。



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.

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;
}


这篇关于将本地计算机上的图像转换为pdf并将其保存在本地计算机的同一文件夹中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆