[Share Experiences] 万兴pdf wine方案
Tofloor
poster avatar
川顺页
deepin
2023-02-21 19:50
Author

准备工作

  1. 安装wine8.0稳定版。推荐用源,ubuntu参考这个链接)。也可以用wine运行器安装,deepin用户推荐用这个。
  2. 安装winetricks
# 不推荐,这个要加--force才能安装dotnet
sudo apt install winetricks
# 或者(推荐)
sudo wget "https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks" -O /usr/bin/winetricks && sudo chmod +x /usr/bin/winetricks && sudo apt install cabextract
  1. 设置全局中文。
vim /etc/profile

# 加入下面的代码到末尾
export LC_ALL=zh_CN.utf8
  1. 安装wine-gecko(32位),运行命令,会自动联网安装wine-mono,点击取消即可,其中~/.deepinwine/wine-WondersharePDF是容器位置。请确保.deepinwine目录存在,如果不存在请创建一个,win32位对wine版的dotnet兼容性更好。
wget https://dl.winehq.org/wine/wine-gecko/2.47.3/wine-gecko-2.47.3-x86.msi

WINEPREFIX=~/.deepinwine/wine-WondersharePDF WINEARCH=win32 wine start /i wine-gecko-2.47.3-x86.msi
  1. 利用winetircks安装.net framework 3.5和.net framework 4.6.1(软件提示需要安装这个,然后winetricks提示32位对dotnet的兼容性更好,所以选择wine32架构来安装)-q即静默安装,无需用户二次确认。
LC_ALL=C WINEPREFIX=~/.deepinwine/wine-WondersharePDF WINEARCH=win32 winetricks -q dotnet35

LC_ALL=C WINEPREFIX=~/.deepinwine/wine-WondersharePDF WINEARCH=win32 winetricks -q dotnet461
  1. 修改分辨率(可选)。输入 winetricks,“选择默认的Wine容器”,点击“确定”,“运行Wine配置程序”,“显示”,默认分辨率是96,如果你想放大两倍,则改成192即可。点击“应用”,“确定”。然后会返回winetricks,点击取消即可。
  2. 安装中文字体。一定程度上解决字体发虚问题。
    输入
WINEPREFIX=~/.deepinwine/wine-WondersharePDF WINEARCH=win32 winetricks
  • “选择默认的Wine容器”,点击“确定”,点击“安装字体”,点击“确定”,勾选 fakechinesetamoha字体。

正式安装

  1. 安装前copy一份容器,万一失败了还能回退一下。
cp -r ~/.deepinwine/wine-WondersharePDF ~/.deepinwine/wine-WondersharePDF-bak
  1. 安装万兴PDF,官网下载地址自行百度即可,一直点下一步即可,使用默认安装位置即可。安装完后点击即可启动,此时可以看到程序正常启动。
LC_ALL=zh_CN.UTF-8 WINEPREFIX=~/.deepinwine/wine-WondersharePDF WINEARCH=win32 wine pdfelement_full5387.exe
  1. 手动启动测试一下
LC_ALL=zh_CN.UTF-8 WINEPREFIX=~/.deepinwine/wine-WondersharePDF WINEARCH=win32  wine "C:/Program Files/Wondershare/万兴PDF(Windows版)/PDFExpert.exe"
  1. 图标位置 ~/.local/share/applications/wine/Programs/PDF Reader Pro,如果你看不到图标,可以尝试把这个下面的.desktop文件放到 /usr/share/applications(适用于ubuntu),理论上应该不需要修改了。

修复中文乱码

  • 貌似中文字体乱码,乱码部分为字体选择框,翻译选择框,标注评论输入框。
方法1
  • 测试没啥用,需要默认一下微软雅黑参考教程。。
  • 先将微软雅黑字体放进去,可以利用wine运行器的字体商店安装msyh和msyhbd。
  • 修改系统注册表。
export system_reg=~/.deepinwine/wine-WondersharePDF/system.reg
sed -i "s/\"MS Shell Dlg\"=\"msyh\"/\"MS Shell Dlg\"=\"msyh\"/g" $system_reg
sed -i "s/\"MS Shell Dlg\"=\"SimSun\"/\"MS Shell Dlg\"=\"msyh\"/g" $system_reg
sed -i "s/\"MS Shell Dlg 2\"=\"Tahoma\"/\"MS Shell Dlg 2\"=\"msyh\"/g" $system_reg
cat $system_reg | grep "MS Shell Dlg"
  • 编写一个字体注册服务,放到windows的temp目录下
vim ~/.deepinwine/wine-WondersharePDF/drive_c/windows/temp/msyh_config.reg
  • 内容如下:
REGEDIT4
[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\FontLink\SystemLink]
"Lucida Sans Unicode"="msyh.ttc"
"Microsoft Sans Serif"="msyh.ttc"
"MS Sans Serif"="msyh.ttc"
"Tahoma"="msyh.ttc"
"Tahoma Bold"="msyhbd.ttc"
"msyh"="msyh.ttc"
"Arial"="msyh.ttc"
"Arial Black"="msyh.ttc"
  • 最后注册服务
cd ~/.deepinwine/wine-WondersharePDF/drive_c/windows
WINEPREFIX=~/.deepinwine/wine-WondersharePDF WINEARCH=win32 wine regedit temp/msyh_config.reg
方法2:
  • 利用wine运行器,点击字体商店,安装fake_simsun,此方案将由微软雅黑来伪装宋体(可选,因为之前已经安装了fackchinese字体,那个就是由思源黑体来伪装宋体)。
  • 修改容器内系统注册表的默认字体,将主字体和附属字体都改成宋体(当然这个宋体实际是微软雅黑)。
  • 快捷修改命令如下:
export system_reg=~/.deepinwine/wine-WondersharePDF/system.reg
sed -i "s/\"MS Shell Dlg 2\"=\"Tahoma\"/\"MS Shell Dlg 2\"=\"SimSun\"/g" $system_reg
cat $system_reg | grep "MS Shell Dlg"
  • 输出结果如下:
"MS Shell Dlg"="SimSun"
"MS Shell Dlg 2"="SimSun"
  • 再次打开软件,可以看到唯一的注释输入框中文乱码正常显示了,并且软件默认字体从Tahoma变成了宋体。

关于右键添加打开方案

  • 根据我的观察,关于右键可以pdf打开,有三种方案。
  1. 一个是 .local/share/applications/defaults.list,在“application/pdf”中加入你要启动xx.desktop文件。
    例如,下面是可以打开pdf的所有快捷方式
application/pdf=org.gnome.Evince.desktop;microsoft-edge.desktop;google-chrome.desktop;lbrowser.desktop;FoxitReader.desktop
  1. 或者,在你的xx.desktop中加入下面一列,表示该desktop可以打开pdf文件。
MimeType=application/pdf;application/xfdf;application/fdf;
  1. 第三种方案,在 ~/.local/share/applications创建一个 wine-extension-xxx.desktop,比如 wine-extension-pdf.desktop,这个方案是wine安装后的默认方案。示范内容如下:
[Desktop Entry]
Type=Application
Name=万兴PDF
MimeType=application/pdf;
Exec=env WINEPREFIX="/home/tlntin/.deepinwine/wine-WondersharePDF" wine start /ProgIDOpen PDFExpert.AssocFile.PDF %f
NoDisplay=true
StartupNotify=true
Icon=E8CF_PDFExpert.0
  • 注,第二种方案比较适合wine运行器。

    image.png

  • 效果如下:

    image.png

  • 注:MineType内容为:application/pdf;application/xfdf;application/fdf;

  • 如果还要能右键打开图片,用于图片转pdf功能,可以加上这几个。image/png;image/jpeg;image/gif;

  • 注:可选参数为:-f z:%f

打包分发

  1. 分发前copy一份,不然打包器会对容器做修改。打包建议直接用wine运行器
cp -r ~/.deepinwine/wine-WondersharePDF ~/.deepinwine/wine-WondersharePDF-bak
  1. 运行wine运行器,参考该教程打包即可。

已知问题

  • 将应用收藏到dock栏,然后打开应用后,显示两份图标,修改方法如下(建议后续wine运行器生成的.desktop可以自动完成这个操作):
vim /usr/share/applications/com.wondershare.pdf.desktop
  • 添加下面一行(注意右边的xx.exe一定要小写)
StartupWMClass=pdfexpert.exe
  • 刷新一下
sudo update-desktop-database /usr/share/applications/
  • 可以直接将deb解包,改好后再重新打包一下。
Reply Favorite View the author
All Replies
川顺页
deepin
2023-02-21 19:53
#1

安装.net frameword 的两条核心命令。

LC_ALL=C WINEPREFIX=~/.wine32 WINEARCH=win32 winetricks -q dotnet35

LC_ALL=C WINEPREFIX=~/.wine32 WINEARCH=win32 winetricks -q dotnet461

WINEPREFIX为容器路径。

WINARCH为系统架构,选择32位

winetricks采用第二种安装方式。

-q代表静默安装,即不显示界面。

dotnet35代表.net framwork 3.5

dotnet461代表.net framework 4.6.1,安装的同时会自动安装.net 4.0/4.5/4.6/4.6.1。

Reply View the author
晚秋(lateautumn)
Moderator
2023-02-21 20:32
#2

学习了kissing_heart

Reply View the author
delsin
deepin
2023-02-22 01:00
#3

偷偷告诉你,用wine运行Adobe Acrobat XI Pro,网上下载一个amtlib.dll补丁,替换一下,就可以原地起飞了。

Reply View the author
川顺页
deepin
2023-02-22 01:29
#4
delsin

偷偷告诉你,用wine运行Adobe Acrobat XI Pro,网上下载一个amtlib.dll补丁,替换一下,就可以原地起飞了。

👍 这个大家都知道哈。

老了,不想用盗版了。😄

Reply View the author