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


返回   几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量 » 仿射空间:CAX软件开发(三)二次开发与程序设计 » CAD二次开发 » AutoCAD二次开发 » DirectDWG
用户名
密码
注册 帮助 会员 日历 银行 搜索 今日新帖 标记论坛为已读


回复
 
主题工具 搜索本主题 显示模式
旧 2009-05-06, 10:54 PM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】problem pdf export linu

problem pdf export linux
problem pdf export linux
hallo,
i want to write a console program to convert dwg/dwf to pdf. i have found the following code in the forum and changed it a little bit.
but when i start the program i have always a segmentation fault.
backtrace
-------------------------------
#0 0x08b67257 in oddbfontservices::loadstylerec ()
#1 0x08b0fab2 in odgitextstyle::loadstylerec ()
#2 0x08810f6b in gifromdbtextstyle ()
#3 0x0881115a in gifromdbtextstyle ()
#4 0x08584be6 in oddbtextimpl::draw ()
#5 0x085853d3 in oddbtextimpl::draw1 ()
#6 0x08585590 in oddbtext::worlddraw ()
#7 0x089a9e6f in odgibasevectorizer::dodraw ()
#8 0x08955af4 in odgsbasevectorizeview::dodraw ()
#9 0x089aafda in odgibasevectorizer::draw ()
#10 0x087c9422 in oddbblocktablerecord::worlddraw ()
#11 0x089a9e6f in odgibasevectorizer::dodraw ()
#12 0x08955af4 in odgsbasevectorizeview::dodraw ()
#13 0x089aafda in odgibasevectorizer::draw ()
#14 0x08969a69 in odgsbasevectorizeview::updateextents ()
#15 0x0897044b in odgsbasevectorizeview::viewextents ()
#16 0x088e5eb3 in odabstractviewpeforgsview::viewextents ()
#17 0x081f142f in odabstractviewpe::zoomextents ()
#18 0x08058b94 in cpdfexportimpl::drawzoomed2extents ()
#19 0x0805e418 in cpdfexportimpl::run ()
#20 0x0805728c in exportpdf ()
#21 0x08050baf in main (argc=3, argv=0xbfd15ee4) at ../../examples/odpdfexport/odpdfexport.cpp:135
makefile
-----------------------------------------------------------
# sample dwgdirect makefile for unix platforms.
# to use this makefile:
# 1. change the plt variable below to match the library name for
# the desired platform.
# 2. change the cc variable below according to the dwgdirect
# build documentation for your platform.
# 3. modify the rdsrc, exsrc and inc variables below (if necessary)
# to correctly reflect the location of your source and header files.
#
# this makefile assumes that the dwgdirect library files will be located
# in the same directory as the makefile.
# the platform name used in the archive names for a specific platform,
# for example, dd_lnxx86_db.a.
plt = lnxx86
# platform specific compiler command (linux is provided as a sample)
cc = g++ -g -wno-deprecated
# location of odreadex source files.
rdsrc = ../../examples/odpdfexport
# location of exservices source files.
svsrc = ../../extensions/exservices
# location of exservices source files.
comsrc = ../../examples/common
# location of exservices source files.
vecsrc = ../../examples/odvectorizeex
# location of dwgdirect header files.
inc = -i../../include -i$(svsrc) -i../common -i$(vecsrc) -i../../exports/pdfexport/include \
-i../../exports/pdfexport/pdftoolkit -i../../exports/2dexport/include
# object files required to build odreadex
#objs = exsystemservices.o exhostappservices.o exundocontroller.o \
# odfilebuf.o odreadex.o dbdumper.o exprotocolextension.o \
# giworlddrawdumper.o exgirasterimage.o tostring.o \
# exgssimpledevice.o giconveyorgeometrydumper.o gidumperimpl.o
objs = exsystemservices.o exhostappservices.o exundocontroller.o \
odfilebuf.o odpdfexport.o \
tostring.o
#../../../dgndirect/lib/lnxx86_4.1/zlib.a ../../../dgndirect/lib/lnxx86_4.1/pstoolkit.a \
#../../lib/lnxx86_4.1/dd_$(plt)_zip.a -ldwftk -ldwfcore -luuid -ljpeg -lz
# dwgdirect librarys required to build odreadex
libs = ../../lib/lnxx86_4.1/dd_$(plt)_pdfexport.a ../../lib/lnxx86_4.1/dd_$(plt)_pdftoolkit.a \
../../lib/lnxx86_4.1/dd_$(plt)_dwfimport.a \
../../lib/lnxx86_4.1/dwftoolkit.a \
../../lib/lnxx86_4.1/whiptk.a \
../../lib/lnxx86_4.1/dwfcore.a \
../../lib/lnxx86_4.1/dd_$(plt)_dwfexport.a \
../../lib/lnxx86_4.1/dd_$(plt)_modelergeometry.a ../../lib/lnxx86_4.1/dd_$(plt)_breprenderer.a \
../../lib/lnxx86_4.1/dd_$(plt)_br.a ../../lib/lnxx86_4.1/dd_$(plt)_acisbuilder.a \
../../lib/lnxx86_4.1/dd_$(plt)_db.a ../../lib/lnxx86_4.1/dd_$(plt)_gs.a \
../../lib/lnxx86_4.1/dd_$(plt)_spatialindex.a ../../lib/lnxx86_4.1/dd_$(plt)_gi.a \
../../lib/lnxx86_4.1/dd_$(plt)_ge.a ../../lib/lnxx86_4.1/dd_$(plt)_root.a \
../../lib/lnxx86_4.1/dd_$(plt)_dbroot.a \
../../lib/lnxx86_4.1/dd_$(plt)_rxrasterprocessor.a \
../../lib/lnxx86_4.1/dd_$(plt)_rxplotstyleservices.a \
../../lib/lnxx86_4.1/gs_winbitmap.a \
../../lib/lnxx86_4.1/dd_$(plt)_ft.a ../../lib/lnxx86_4.1/dd_$(plt)_alloc.a \
../../lib/lnxx86_4.1/dd_$(plt)_recomputedimblock.a \
../../lib/lnxx86_4.1/dd_$(plt)_exfieldevaluator.a \
-ldwftk -ldwfcore -luuid -ljpeg -lz
odpdfexport : $(objs)
$(cc) -o odpdfexport $(objs) $(libs)
odpdfexport.o : $(rdsrc)/odpdfexport.cpp
$(cc) -c $(inc) $(rdsrc)/odpdfexport.cpp
exsystemservices.o : $(svsrc)/exsystemservices.cpp
$(cc) -c $(inc) $(svsrc)/exsystemservices.cpp
exhostappservices.o : $(svsrc)/exhostappservices.cpp
$(cc) -c $(inc) $(svsrc)/exhostappservices.cpp
exundocontroller.o : $(svsrc)/exundocontroller.cpp
$(cc) -c $(inc) $(svsrc)/exundocontroller.cpp
odfilebuf.o : $(svsrc)/odfilebuf.cpp
$(cc) -c $(inc) $(svsrc)/odfilebuf.cpp
exgirasterimage.o : $(svsrc)/exgirasterimage.cpp
$(cc) -c $(inc) $(svsrc)/exgirasterimage.cpp
dbdumper.o : $(rdsrc)/dbdumper.cpp
$(cc) -c $(inc) $(rdsrc)/dbdumper.cpp
exprotocolextension.o : $(rdsrc)/exprotocolextension.cpp
$(cc) -c $(inc) $(rdsrc)/exprotocolextension.cpp
giworlddrawdumper.o : $(rdsrc)/giworlddrawdumper.cpp
$(cc) -c $(inc) $(rdsrc)/giworlddrawdumper.cpp
tostring.o : $(comsrc)/tostring.cpp
$(cc) -c $(inc) $(comsrc)/tostring.cpp
exgssimpledevice.o : $(vecsrc)/exgssimpledevice.cpp
$(cc) -c $(inc) $(vecsrc)/exgssimpledevice.cpp
giconveyorgeometrydumper.o : $(vecsrc)/giconveyorgeometrydumper.cpp
$(cc) -c $(inc) $(vecsrc)/giconveyorgeometrydumper.cpp
gidumperimpl.o : $(vecsrc)/gidumperimpl.cpp
$(cc) -c $(inc) $(vecsrc)/gidumperimpl.cpp
source
------------------------------------------------------------------------------------
#ifdef _msc_ver
#define _win32_winnt 0x0400 // to enable windows cryptographic api
#endif
#include "odacommon.h"
#include "dbdatabase.h"
#include "dbentity.h"
#include "dbdimassoc.h"
#include "odcharmapper.h"
#include "rxobjectimpl.h"
#include "exsystemservices.h"
#include "exhostappservices.h"
//#include "exprotocolextension.h"
#include "modelergeometry/modelermodule.h"
#include "odfilebuf.h"
#include "colormapping.h"
#include "../../exports/dwfexport/include/dwfexport.h"
#include "rxdynamicmodule.h"
#include "ps/plotstyles.h"
//#include "fdfield.h"
#include "dbtextiterator.h"
#define stl_using_iostream
#include "odastl.h"
#define std(a) std:: a
//#include "dbdumper.h"
#if defined(target_os_mac) && !defined(__mach__)
#include <console.h>
#endif
//#include "pdftoolkitexportdef.h"
//#include "pdfaux.h"
#include "pdfexport.h"
/************************************************** **********************/
/* compile password support for r18 drawings */
/************************************************** **********************/
#ifdef _msc_ver
#pragma message ("compiling password support for r18 drawings")
#include "..\win\crypt\winntcrypt.cpp"
#endif
//odrx_declare_static_module_entry_point(modelermodu le);
//odrx_declare_static_module_entry_point(odrecompute dimblockmodule);
//odrx_declare_static_module_entry_point(odrasterpro cessingservicesimpl);
//odrx_declare_static_module_entry_point(exfieldeval uatormodule);
//
//odrx_begin_static_module_map()
// odrx_define_static_application(dd_t("modelergeomet ry"), modelermodule)
// odrx_define_static_application(dd_t("recomputedimb lock"), odrecomputedimblockmodule)
// odrx_define_static_application(dd_t("rasterprocess or"), odrasterprocessingservicesimpl)
// odrx_define_static_appmodule(l"exfieldevaluator.dr x", exfieldevaluatormodule)
//odrx_end_static_module_map()
odrx_declare_static_module_entry_point(modelermodu le);
odrx_declare_static_module_entry_point(odrecompute dimblockmodule);
odrx_declare_static_module_entry_point(bitmapmodul e);
odrx_declare_static_module_entry_point(odrasterpro cessingservicesimpl);
odrx_declare_static_module_entry_point(odpsplotsty leservicesimpl);
odrx_begin_static_module_map()
odrx_define_static_application(dd_t("modelergeomet ry"), modelermodule)
odrx_define_static_application(dd_t("recomputedimb lock"), odrecomputedimblockmodule)
odrx_define_static_appmodule(l"winbitmap.gs", bitmapmodule)
odrx_define_static_appmodule(l"rasterprocessor.drx ", odrasterprocessingservicesimpl)
odrx_define_static_application(odps_plotstyle_serv ices_appname, odpsplotstyleservicesimpl)
odrx_end_static_module_map()
class myservices : public exsystemservices, public exhostappservices
{
protected:
odrx_using_heap_operators(exsystemservices);
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[])
{
/************************************************** ******************/
setlocale(lc_all, "");
/************************************************** ******************/
/* but use usual conversion for scanf()/sprintf() */
/************************************************** ******************/
setlocale(lc_numeric, "c");
#ifndef _toolkit_in_dll_
odrx_init_static_module_map();
#endif
odstaticrxobject<myservices> svcs;
odinitialize(&svcs);
// :drxdynamiclinker()->loadmodule(l"exfieldevaluator.drx");
// :drxdynamiclinker()->loadmodule(l"dd_ftfontengine.drx");
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:dfexportflags(pdfexportparams::k embededttf | pdfexportparams::kshxtextasgeometry | pdfexportparams::kzoomtoextentsmode);
params.flags = pdfexportparams:dfexportflags(pdfexportparams::k zoomtoextentsmode | pdfexportparams::kshxtextasgeometry);
params.busehlr = 0;
oduint32 errcode = exportpdf(params);
if (errcode != 0)
{
odstring errmes = exportpdferrorcode(errcode);
// cstring str;
// str.format(_t("error number : 0x%x. \n %ls"), errcode, errmes.c_str());
if (errcode == 0x10008)
{
odprintconsolestring(l"\nplease enable zoom to extents check box or\ndefine page parameters for layout in page setup dialog.\n");
}
odprintconsolestring(l"exportpdf errcode: 0x%x. \n %ls\n",errcode, errmes.c_str());
}
}
}
catch (oderror& e)
{
odprintconsolestring(l"statuswgdirect error: %ls\n",svcs.geterrordescription(e.code()).c_str()) ;
}
catch (...)
{
odprintconsolestring(l"status:unknown error.\n");
}
}
what is wrong ??? !!!!!
have you tried 2.7.0 available at
?
sergey slezkin
... hm ... linux ... ???? !!!!!
sorry..
some problems in pdf export on linux were fixed before 2.6.3 release.
but a bug in oddbfontservices::loadstylerec () was fixed just before 2.7.0 (it's not linux specific).
sergey slezkin
ok,
i work with 2.6.3. is the problem in my sourcecode or ??? !!!
i have not not found a complete example for pdf export.
can anyone help !!!!
hallo,
i have found the error for my self. do not define a odstring findfile(...) function in myservices class and all works perfectly.
this helps not in all situations. loadstylerec() contains a bug which may cause the same error (but not always). the linux release with the fix is expected in the middle of january.
sergey slezkin
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)
回复


主题工具 搜索本主题
搜索本主题:

高级搜索
显示模式

发帖规则
不可以发表新主题
不可以回复主题
不可以上传附件
不可以编辑您的帖子

vB 代码开启
[IMG]代码开启
HTML代码关闭

相似的主题
主题 主题发起者 论坛 回复 最后发表
【转帖】pdfexport not working for oddbpolyfacemesh yang686526 DirectDWG 0 2009-05-06 09:52 PM
【转帖】pdf-export layer-output problems in linu yang686526 DirectDWG 0 2009-05-06 09:52 PM
【转帖】pdf export question yang686526 DirectDWG 0 2009-05-06 09:50 PM
【转帖】export pdf with gray scale outpu yang686526 DirectDWG 0 2009-05-05 10:26 AM
下载好多软件 ping CAD资料交换区 6 2007-03-03 09:13 PM


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


于2004年创办,几何尺寸与公差论坛"致力于产品几何量公差标准GD&T | GPS研究/CAD设计/CAM加工/CMM测量"。免责声明:论坛严禁发布色情反动言论及有关违反国家法律法规内容!情节严重者提供其IP,并配合相关部门进行严厉查处,若內容有涉及侵权,请立即联系我们QQ:44671734。注:此论坛须管理员验证方可发帖。
沪ICP备06057009号-2
更多