当前位置:网站首页>Processing PDF and JPG files in VB6
Processing PDF and JPG files in VB6
2022-07-24 23:29:00 【Who was that yesterday】
A recent project needs pdf The file page is output as jpg Picture file , And then for these outputs jpg Page clipping .
because VB6 It's old , Many mainstream plug-ins do not vb6 Usable api Or sample code , I've been looking for it on the Internet for a long time , To sum up VB6 Feasible plan :
One 、 Handle pdf file
1.Apache PDFBox
PDFBox It's a use Java Open source PDF Document processing library
Download here :
http://pdfbox.apache.org/
Because it's using Java Compiling , So you need to install... Before use jre
The program supports command line , stay VB The specific calling method in is shell() Command invocation , for example :
shell ("java -jar pdfbox-app-2.0.4.jar PDFToImage -imageType jpg C:\1.pdf") The above command will be a pdf All pages of the file are output as jpg picture , There are many other commands that can be used , Specific reference :
http://pdfbox.apache.org/2.0/commandline.html
PDFBox One big disadvantage is that the processing speed is slow
2.Debenu Quick PDF Library
Debenu At present, it has been used by domestic Foxit Fuxi acquired , It's a commercial software , You need to pay for it , But you can find the registration code online .
Required after download ActiveX Of quickpdf.dll and quickpdf.tlb Two documents , You can use the system's own Regsvr32 register quickpdf.dll, Or not , If there is an error running on other computers, you need to register .
menu bar - engineering - quote , Select browse , Choose quickpdf.tlb Later, this library was referenced in the project : 
Next , Can press F2 Check the objects that can be called in this library , The complete development documentation is here :
http://www.debenu.com/products/development/debenu-pdf-library/help/developer-guide/
The next step is to enter the actual development process , Because it's commercial software , First, you need to enter the registration information :
Dim pb As New DebenuPDFLibraryAX1016.PDFLibrary
Dim RegStatus As Integer
RegStatus = pb.UnlockKey("j87ig3k84fb9eq9dy34z7u66y")
Print RegStatusIf it returns RegStatus by 1, It indicates that the registration is successful
take PDF The page is converted into a picture file :
QP.LoadFromFile("sample.pdf", "") ' The first step is to load the file into memory
iNumPages = QP.PageCount() ' obtain pdf Number of pages of the file
QP.RenderDocumentToFile(100, 1, iNumPages, 0, "image.bmp") ' transformation For other commands, please refer to the development documentation
Two 、 Handle jpg image file
There are two solutions offered online : Use GDI+; call Intel JPEG lib. Here is another open source solution FreeImage, Support jpg、png、bmp And other image processing , Download here dll And development documentation :
http://freeimage.sourceforge.net/download.html
The required files are in the compressed package FreeImage.dll and modFreeImage.bas, Put the two files in the program directory .
Build a new project , take modFreeImage.bas Add as a module , So you can call dll 了 .
Resample the image :
Dim dib As Long
Dim dib2 As Long
dib = FreeImage_LoadU(FIF_JPEG, "jpgfile.jpg",0) ' Load pictures into memory
dib2 = FreeImage_Rescale(dib, 1280, 800, FILTER_BOX) ' Resampling
Call FreeImage_SaveU(FIF_JPEG, dib2, "tgfile.jpg",0) ' Save the file
FreeImage_Unload(dib) ' Free memory 边栏推荐
- 激光雷达障碍物检测与追踪实战——cuda版欧式聚类
- Implementation of cat and dog data set classification experiment based on tensorflow and keras convolutional neural network
- 谢振东:公共交通行业数字化转型升级的探索与实践
- 先工程实践,还是先工程思想?—— 一位本科生从学oi到学开发的感悟
- Convert a string to an integer and don't double it
- 认识复杂度和简单排序运算
- burp从溯源到反制思路
- Pointrender parsing
- Excel文件处理工具类(基于EasyExcel)
- JS ------ Chapter 5 functions and events
猜你喜欢

基于Verilog HDL的数字秒表

Convex optimization Basics

How to propose effective solutions for high-end products? (1 methodology + 2 cases + 1 List)

Go basic notes_ 4_ map

Nvida tensorrt deployment (I)

Notes of Teacher Li Hongyi's 2020 in-depth learning series 8

Zheng Huijuan: Research on application scenarios and evaluation methods of data assets based on the unified market

HTB-Aragog

痞子衡嵌入式:MCUXpresso IDE下将源码制作成Lib库方法及其与IAR,MDK差异

About constant modifier const
随机推荐
Notes of Teacher Li Hongyi's 2020 in-depth learning series lecture 1
聊聊 Redis 是如何进行请求处理
这个月 google的“AI具备意识”的事件的想法
Horizontally centered element
基于TensorFlow和Keras的卷积神经网络实现猫狗数据集分类实验
Notes of Teacher Li Hongyi's 2020 in-depth learning series 9
Use of serial queues
I'd like to ask if the table creation DDL of ODPs can't be directly executed in MySQL. The string type is incompatible. Can you only adjust this by yourself
痞子衡嵌入式:MCUXpresso IDE下将源码制作成Lib库方法及其与IAR,MDK差异
JS ------ Chapter II JS logic control
The idea of Google's "Ai awareness" event this month
Background image and QR code synthesis
JDBC 驱动升级到 Version 8.0.28 连接 MySQL 的踩坑记录
Go基础笔记_4_map
Mandatory interview questions: 1. shallow copy and deep copy_ Deep copy
Video chat source code - one-to-one live broadcast system source code
Notes of Teacher Li Hongyi's 2020 in-depth learning series 2
Process / thread synchronization mechanism
Outlook邮件创建的规则失效,可能的原因
Network Security Learning (V) DHCP