Pārlūkot izejas kodu

CorelDRAW CPG 开源项目发布

Hongwenjun 3 mēneši atpakaļ
vecāks
revīzija
c5edf14221
2 mainītis faili ar 103 papildinājumiem un 5 dzēšanām
  1. 6 5
      donate.md
  2. 97 0
      module/savePDFtoClip.bas

+ 6 - 5
donate.md

@@ -2,10 +2,11 @@
 ![](https://lyvba.com/wp-content/uploads/2023/12/vlog_lanya.jpg)
 ### 2022.12.13 庆祝蘭雅CorelVBA工具捐赠和收益总额达到3000元
 ### 2023.12.29 庆祝蘭雅CorelVBA工具捐赠和收益总额达到5000元
+### 2024.06.15 蘭雅 CorelDRAW CPG 开源项目发布
 ## 捐赠
-感谢您使用 "蘭雅CorelVBA工具"
+感谢您使用 "蘭雅CorelVBA工具" 和 蘭雅 CorelDRAW CPG 工具
 
-感谢您的捐赠,它将有助于 "蘭雅CorelVBA工具" 的后续开发。
+感谢您的捐赠,它将有助于 "蘭雅CorelVBA工具" 和 蘭雅CPG插件 的后续开发。
 
 捐赠将用于硬件、软件、服务器托管和其他费用。
 
@@ -13,7 +14,7 @@
 
 蘭雅sRGB(蘭公子)
 
-
+[![](https://raw.githubusercontent.com/hongwenjun/vps_setup/master/img/paypal.png)
 | 微信支付 | 支付宝 |
 | ------- | ------- |
 | ![](https://lyvba.com/donate/WXPay.png) | ![](https://lyvba.com/donate/AliPay.jpg) |
@@ -24,8 +25,8 @@
 [%ĀĀÙ]客服中心    溜溜    A    顶天办公    廣告标识    大白    √奋斗吧√    哈哈  
 深蓝*浅蓝    壹方-渐变牙刷    zdj168    99彩印    JZ捷众广告    醉后的最后    骑着"蜗牛"撵娘们    
 极速龙广告装饰图文快印②    a-嘉盟    幼儿园最亮的仔    舞    方华广告    肥崽很忙    
-Thanh Van    友佳友汇    创忆电脑    李凯    晋畅迷你字    cdr_插件 鼠标哥    w啊啊    上善若水    
-肇庆博洋文化传媒    hi    夏夜里的荷花与星星    无风   风雅广告
+Thanh Van    友佳友汇    创忆电脑    李凯    晋畅迷你字    cdr插件鼠标哥    w啊啊    上善若水    
+肇庆博洋文化传媒    hi    夏夜里的荷花与星星    无风   风雅广告  告别原来的自己 
 ```
 ### 会员群福利: 
 ```

+ 97 - 0
module/savePDFtoClip.bas

@@ -0,0 +1,97 @@
+Attribute VB_Name = "savePDFtoClip"
+#If VBA7 Then
+  Private Declare PtrSafe Function vbadll Lib "lycpg64.cpg" (ByVal code As Long, ByVal x As Double) As Long
+#Else
+  Private Declare Function vbadll Lib "lycpg32.cpg" (ByVal code As Long, ByVal x As Double) As Long
+#End If
+
+Sub CorelDRAW_CopyPDF()
+'//  savePDFtoClip.CdrCopyToAI
+'// VBA调用CPG_CDR复制物件到AI()
+ ret = vbadll(2, 0)
+ 
+End Sub
+
+Sub CorelDRAW_PastePDF()
+'//  savePDFtoClip.AICopyToCdr
+'// AI复制物件到CDR()
+ ret = vbadll(1, 0)
+End Sub
+
+Private Function GetTempFile(ByVal sExtension As String) As String
+    GetTempFile = CorelScriptTools.GetTempFolder() & "CDR2AI" & "." & sExtension
+End Function
+
+Public Function CdrCopyToAI()
+  On Error GoTo ErrorHandler
+  sTempFilePDF = GetTempFile("pdf")
+  
+    With ActiveDocument.PDFSettings
+        .PublishRange = 2 ' CdrPDFVBA.pdfSelection
+        .BitmapCompression = 1 ' CdrPDFVBA.pdfLZW
+        .JPEGQualityFactor = 2
+        .EmbedFonts = True
+        .EmbedBaseFonts = True
+        .TrueTypeToType1 = True
+        .SubsetFonts = False
+        .SubsetPct = 80
+        .CompressText = True
+        .Encoding = 1 ' CdrPDFVBA.pdfBinary
+        .ColorResolution = 300
+        .MonoResolution = 1200
+        .GrayResolution = 300
+        .Hyperlinks = True
+        .Bookmarks = True
+        .Thumbnails = True
+        .Startup = 0 ' CdrPDFVBA.pdfPageOnly
+        .Overprints = True
+        .Halftones = True
+        .FountainSteps = 256
+        .EPSAs = 0 ' CdrPDFVBA.pdfPostscript
+        .pdfVersion = 6 ' CdrPDFVBA.pdfVersion15
+        .ColorMode = 3 ' CdrPDFVBA.pdfNative
+        .ColorProfile = 1 ' CdrPDFVBA.pdfSeparationProfile
+        .JP2QualityFactor = 2
+        .TextExportMode = 0 ' CdrPDFVBA.pdfTextAsUnicode
+        .PrintPermissions = 0 ' CdrPDFVBA.pdfPrintPermissionNone
+        .EditPermissions = 0 ' CdrPDFVBA.pdfEditPermissionNone
+        .EncryptType = 1 ' CdrPDFVBA.pdfEncryptTypeStandard
+    End With
+  
+  ActiveDocument.PublishToPDF sTempFilePDF
+  
+  '// 调用 pdf2clip.exe 把PDF文件加载到剪贴板,  命令行按实际文件夹填写路径
+  
+  cmd_line = "C:\TSP\pdf2clip.exe  " & sTempFilePDF
+  ret = Shell(cmd_line, vbHide)
+  
+ErrorHandler:
+End Function
+
+Public Function AICopyToCdr()
+  On Error GoTo ErrorHandler
+  sTempFilePDF = GetTempFile("pdf")
+  '// 调用 clip2pdf.exe 把读取剪贴板保存成PDF
+  cmd_line = "C:\TSP\clip2pdf.exe  " & sTempFilePDF
+
+  Dim ret As Long
+  ret = Shell(cmd_line, vbHide)
+  
+  '// 暂停 1 秒 让Shell 调用exe程序完成结果
+  Dim startTime As Variant
+  startTime = Now
+  Do While (Now - startTime) < TimeSerial(0, 0, 1)
+    DoEvents
+  Loop
+
+Dim impopt As StructImportOptions
+Set impopt = CreateStructImportOptions
+impopt.MaintainLayers = True
+
+Dim impflt As ImportFilter
+Set impflt = ActiveLayer.ImportEx(sTempFilePDF, cdrAI9, impopt)
+impflt.Finish
+
+ErrorHandler:
+End Function
+