eclipse-gmf


Printing GMF diagrams using PDFCreator not able to open the generated pdf


I have implemented a direct printing to files of some GMF diagrams. The diagrams are opened, printed to file and the diagrams then closed. The issue I am facing is withing the following point:
private static void printDiagrams(IEditorPart editorPart,org.eclipse.gmf.runtime.diagram.ui.printing.internal.util.SWTDiagramPrinter
diagramPrinter,String diagName) {
PrinterData printData = new PrinterData("winspool","PDFCreator");
if(printData!=null)
{
printData.printToFile = true;
printData.fileName = "D:\\"+diagName+".pdf";
printData.scope= 0;
final Printer printer = new Printer(printData);
diagramPrinter.setPrinter(printer);
diagramPrinter.setDisplayDPI(Display.getDefault().getDPI());
diagramPrinter.setFitToPage(true);
DiagramEditPart dgrmEP = ((DiagramEditor) editorPart).getDiagramEditPart();
assert dgrmEP != null;
diagramPrinter.setDiagrams(Collections.singletonList(((DiagramEditor) editorPart).getDiagram()));
diagramPrinter.run();
printer.dispose();
}
The issue is that with the above code I receive error during opening of pdf file. " Acrobat Reader could not open ... .pdf because it is either not supported file type or because the file has been damaged"
Tried also to put a sleep to be sure that printing is finished before disposing the printer. Same error in the end occured.
Any hint is helpful.
Figured it out that the generated file was not pdf at all , but prn file, intermediate files that a printer is storing before converting to final output. The after creating the prn files a conversion to the desired format is needed, in my case to pdf.
Hope this will help somebody also.
Cheers.

Related Links

selecting one Node (along with inside edges) from CSSDiagramImpl file and saving it in a new file
Managed layout in an EuGENia script
How to make lifeline shape in GMF?
Printing GMF diagrams using PDFCreator not able to open the generated pdf
GMF change the colour of a connection
Eclipse GMF Model selected Wizward could not be started
GMF how to create different shapes for link decorations
What is this error Phantom nodes that are not targeted by a link mapping representing containment reference present in model
How To Obtain All the Nodes and Connections After Launching the GMF Project
Starting with Eclipse GMF

Categories

HOME
php
elasticsearch
mpdf
clearcase
openlayers-3
consul
mirc
swift2
joomla3.2
static-analysis
timber
clickable-image
fireloop
bundler
sonicwall
tomcat8
exe
gravity
checkout
varnish-vcl
tfsbuild
adminlte
social-tables
bosun
altium-designer
rxjs5
channel
firemonkey-style
web-push
data-collection
unrar
msdeploy
tightvnc
mongoengine
counting
winrm
wdk
cartopy
suds
uipickerview
sendinput
bit-shift
spongycastle
jgrapht
iptv
embedded-v8
kendo-editor
.when
mechanicalturk
front-camera
conan
gnucash
django-redis
teamviewer
dsa
dnx50
incron
lifetime
dc
global-scope
smacss
visual-studio-6
relationships
nodeload
wso2bam
iosched
pbkdf2
boinc
revmob
unrealscript
node.js-stream
ui-design
reentrancy
jquery-cycle
onconfigurationchanged
wiktionary
space-partitioning
grails-validation
mongrel2
aptitude
ccl
ccnet-config
resharper-5.1
spring-modules
watchpoint
chronic
account-management

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App