Skip to content

Commit 5d773ec

Browse files
committed
2 parents 68e2cc0 + cd681d5 commit 5d773ec

File tree

3 files changed

+37
-4
lines changed

3 files changed

+37
-4
lines changed

AddinUtilities.cs

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,31 @@ public static bool executeDviPs(LatexEquation equation)
348348
return true;
349349
}
350350

351+
public static bool executePs2Pdf(LatexEquation equation)
352+
{
353+
string appPath = AddinUtilities.getAppDataLocation();
354+
Directory.SetCurrentDirectory(appPath);
355+
356+
357+
SettingsManager mgr = SettingsManager.getCurrent();
358+
try
359+
{
360+
File.Delete(appPath + "\\teximport.pdf");
361+
}
362+
catch
363+
{
364+
MessageBox.Show("teximport.pdf could not be written. Permission denied.");
365+
return false;
366+
}
367+
368+
string output = "";
369+
370+
// run ps2pdf
371+
startProcess("cmd.exe", "/c \"" + mgr.SettingsData.miktexPath + "\\ps2pdf.exe\" -dNoOutputFonts teximport.ps teximport.pdf", true, false, out output);
372+
373+
return true;
374+
}
375+
351376
public static bool createLatexPng(LatexEquation equation, bool firstRun)
352377
{
353378
// Check paths
@@ -364,7 +389,7 @@ public static bool createLatexPng(LatexEquation equation, bool firstRun)
364389
return true;
365390
}
366391

367-
public static bool createLatexPs(LatexEquation equation)
392+
public static bool createLatexPdf(LatexEquation equation)
368393
{
369394
// Check paths
370395
SettingsManager mgr = SettingsManager.getCurrent();
@@ -376,6 +401,8 @@ public static bool createLatexPs(LatexEquation equation)
376401
return false;
377402
if (!executeDviPs(equation))
378403
return false;
404+
if (!executePs2Pdf(equation))
405+
return false;
379406

380407
return true;
381408
}

Changelog.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
1.0.2
2+
- Convert text to curves before import
3+
4+
1.0.1
5+
- Bugfixes
6+
17
1.0
28

39
- Initial release

LatexDialog.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -240,14 +240,14 @@ private bool generateEquation(bool createShape)
240240
m_finishedSuccessfully = AddinUtilities.createLatexPng(m_latexEquation, false);
241241
else
242242
{
243-
m_finishedSuccessfully = AddinUtilities.createLatexPs(m_latexEquation);
243+
m_finishedSuccessfully = AddinUtilities.createLatexPdf(m_latexEquation);
244244

245245
if (m_finishedSuccessfully)
246246
{
247-
string imageFile = Path.Combine(AddinUtilities.getAppDataLocation(), "teximport.ps");
247+
string imageFile = Path.Combine(AddinUtilities.getAppDataLocation(), "teximport.pdf");
248248
Corel.Interop.VGCore.StructImportOptions impopt = new Corel.Interop.VGCore.StructImportOptions();
249249
impopt.MaintainLayers = true;
250-
Corel.Interop.VGCore.ImportFilter impflt = DockerUI.Current.CorelApp.ActiveLayer.ImportEx(imageFile, Corel.Interop.VGCore.cdrFilter.cdrPSInterpreted, impopt);
250+
Corel.Interop.VGCore.ImportFilter impflt = DockerUI.Current.CorelApp.ActiveLayer.ImportEx(imageFile, Corel.Interop.VGCore.cdrFilter.cdrPDF, impopt);
251251
impflt.Finish();
252252
m_latexEquation.m_shape = DockerUI.Current.CorelApp.ActiveShape;
253253
ShapeTags.setShapeTags(m_latexEquation);

0 commit comments

Comments
 (0)