几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量

几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量 (http://www.dimcax.com/hust/index.php)
-   DirectDWG (http://www.dimcax.com/hust/forumdisplay.php?f=89)
-   -   【转帖】pdf export with plot styles - how (http://www.dimcax.com/hust/showthread.php?t=17874)

yang686526 2009-05-06 09:50 PM

【转帖】pdf export with plot styles - how
 
pdf export with plot styles - how?
pdf export with plot styles - how?
hi,
i've written a very simple test program to export a dwg to pdf using pdfexport. i want to export the active layout using its saved page settings and plot styles. it works fine except plot styles are ignored.
i've written a dummy findfile implementation, which is getting called to locate the .ctb file and it definitely returns the correct path. plotplotstyles is true as is showplotstyles.
can anyone tell me what i need to do to export to pdf with plot styles?
this is my first look at dwgdirect so forgive me if this is a dumb question! :)
tia,
matt.
here's the code:
code:
class myservices : public exsystemservices, public exhostappservices
{
public:
odstring findfile(const odstring& file, oddbbasedatabase* pdb, oddbbasehostappservices::findfilehint hint)
{
odstring sfile = exhostappservices::findfile(file, pdb, hint);
if( !sfile.isempty() )
return sfile;
sfile = "c:\\x\\" + file;
return sfile;
}
};
int main(int argc, char* argv[])
{
odstaticrxobject<myservices> svcs;
odinitialize(&svcs);
try
{
odstring fin(argv[1]);
odstring fout(argv[2]);
oddbdatabaseptr pdb = svcs.readfile(fin.c_str(), true, true, oda::ksharedenyreadwrite);
if (!pdb.isnull())
{
pdfexportparams params;

params.pdb = pdb;
params.ver = pdfexportparams::kpdfv1_4;
params.outputstream = odsystemservices()->createfile(fout.c_str(), oda::kfilewrite, oda::ksharedenyno, oda::kcreatealways);

params.flags = pdfexportparams::pdfexportflags(pdfexportparams::kembededttf | pdfexportparams::kshxtextasgeometry);
params.busehlr = 0;

oduint32 errcode = exportpdf(params);

}
}
catch (oderror& e)
{
odprintconsolestring(l"status:dwgdirect error: %ls\n",svcs.geterrordescription(e.code()).c_str());
}
catch (...)
{
odprintconsolestring(l"status:unknown error.\n");
}
please, test mfcapp pdf export with your file and required plotstyles.
what is used toolkit version ?
hi,
thanks for the prompt repy.
im using dwgdirect 2.6.1.0. i tried it in the vc9 build of mfcapp and plot styles were still ignored. for some reason i thought i'd try it in the vc8 build, and it did work! should i use the vc8 libs then?
matt.
hi
please check the name of plotstyleservices_2.06src_9.drx. it seems that vc9 version has wrong drx name for plot style services module.
(plotstyleservices_2.06src_9.drx is required name)
okay, plot styles work in mfcapp now. but what should i be doing in my simple console application to get pdfs to export with plot styles?
thanks
did you used dll or lib version of the toolkit? did you load to your application plotstyleservices_2.06src_9.drx via :drxdynamiclinker()->loadmodule ?
no, i'm using the libs. i linked to dd_vc9md_pdftoolkit.lib, dd_vc9md_pdfexport.lib and dd_vc9md_rxplotstyleservices.lib...
last edited by matt.spencer@mesaware.co.uk; 31st july 2008 at 09:12 amfff">.
so i don't need to do anything more in the code to ensure the .ctb file is loaded and used? exportpdf should take care of it and i'm just not linking to the right module? do i need to dynamically link to plotstyleservices even if i'm using the libs?
apologies if these are dumb questions, i spend most of my time working in php these days :$ ...
thanks
also (see mfcapp as example how to)
you should add for static application
odrx_declare_static_module_entry_point(odpsplotsty leservicesimpl);
and
odrx_define_static_application(odps_plotstyle_serv ices_appname, odpsplotstyleservicesimpl)

hi,
i still had no luck with this i added the static definition and declaration for plot style services but the plot styles are still being ignored.
is there anything else i should be doing?
thanks in advance,
matt.
do you call
odrx_init_static_module_map();
?
(see odamfcapp.cpp for #ifndef _toolkit_in_dll_)

um, no, i didn't... it works perfectly now. thanks a lot for you help.
matt.


所有的时间均为北京时间。 现在的时间是 09:16 AM.