pdf-export: specific german characters
pdf-export: specific german characters
hello,
we have a second problem in pdf- and dwf-export.
we create a dwgdirect database an make outputfiles in several formats (dwg, dxf, pdf, dwf). the beginning is always the same. at the end we use the dwgdirect-functions writefilefff">, exportdwffff"> and exportpdffff">.
with dwg and dxf we have no problems with german characters (? ? ? ? ...). but in pdf and dwf, these charcters will changed in '?'. but only in non-ttf-fonts (z.b. txt.shx)! arial (z.b) will be correct!
what can we do?
in an other thread we read something about preferences.files.supportpath. but we don't have an own application class because we only use the functions writefilefff">, exportdwffff"> and exportpdffff">. and in dwg/dxf-export our way is correct!
sorry for the bad english description.
does saving to dxf and dwg work for both autocad 2000 and autocad 2006?
sergey slezkin
hello,
that's a good question. and i think, the problem is deeper than i thougt!
in autocad2006 all versions (12,13,14,2000,2004 in dwg and dxf) are correkt.
in your odamfcapp all versions (12,13,14,2000,2004,2007 in dwg and dxf) are wrong.
in intellicad (but an older version) the dwg-and dxf-versions 12,13,14,2000 are correct, the dwg-versions 2002, 2007 can't be read, the dxf-version 2004 is correct and the dxf-version 2007 is wrong.
perhaps the two dxf-files can help to find the cause.
thanks
file formats are:
12, 13, 14,
15 (ac2000 - a2002)
18 (ac2004 - ac2006)
21 (ac2007 - ac2009)
the last one (starting with ac2007) stores texts in unicode.
dwgdirect starting with 2.0 stores texts in unicode too.
so difference in dispaying texts from different versions is possible.
dwg files you attached are of r15 (2002), r18 (2004) and r21 (2007) versions.
on my computer (russian regional settings) all of them are displayed ok by ac2008, odamfcapp, ac2005 and ac2000i.
surely file of r21 (2007) version can't be opened by ac2000 or ac2005.
you wrote that you have no problems with exporting ttf text and shx is wrong.
do you export to pdf shx text as geometry (lines not text)?
if you export shx text as polylines it may be that your application has no access to .shx fonts, in that case it may use built into dwgdirect simplex font which has no german characters.
which dwgdirect version do you use?
odamfcapp should display all your files correctly on computer with installed autocad (it searchs for autocad shx fonts). on computer without autocad installed odamfcapp will display all shx text with built-in simplex.
sergey slezkin
hello sergey,
thanks for the informations. first, the answers to your questions:
1. actually we use dwgdirect 2.6.1, but also in 2.5.2 the results were the same.
2. we have no autocad on our cmputers tu use their shx-fonts.
3. but we have the shx-files in an extra-directory on our computers.
4. we tried both, shx-fonts as lines or text, but without any effects.
so, we thougt the problem is, that the program can't find this shx-files. but what can we do? we create an odstaticrxobject-object, filled an oddb-database and called the function exportpdf. we found no such membervariable for oddbdatabaseptr or odstaticrxobject.
where we can / must define the directory with the shx-files?
here are some parts of our program:
odstaticrxobject<myexportservices> m_svcs;
odinitialize(&m_svcs);
try
{
odstring sname;
odwrfilebuf fb(m_exportfilename.c_str());
m_svcs.disableoutput(true);
m_svcs.resetpatternmanager();
odcodepageid systemcodepageid = m_svcs.systemcodepage();
if (systemcodepageid == cp_undefined)
{
systemcodepageid = cp_ansi_1252;
m_svcs.setsystemcodepage(systemcodepageid);
}
oddbdatabaseptr pdb = m_svcs.createdatabase(true, oddb::kmetric);
pdb->setmeasurement(oddb::kmetric);
oddbsetdwgcodepage((*pdb.get()), m_svcs.systemcodepage());
exportfiller filler(this);
filler.filldatabase(pdb, m_ppatternarray, m_patterncount, imusterindex);
if ((m_fileformat == "dxf") || (m_fileformat == "dwg"))
{
oddb::savetype odfileformat = oddb::kdxf;
if (m_fileformat == "dwg")
odfileformat = oddb::kdwg;
pdb->writefile(&fb, odfileformat, m_fileversion, true, 15); // true -> with save preview
}
else if ((m_fileformat == "pdf")
{
pdfexportparams pdfparams;
bool m_bembedded = false;
bool m_bsimplegeomopt = false;
bool m_bshxasgeometry = true;
bool m_bttfasgeometry = true;
bool m_bzoomtoextents = true;
bool m_benablelayers = false;
bool m_bexportofflayers = false;
if (m_pdfversion == 150)
{
m_benablelayers = true;
m_bexportofflayers = true;
}
double m_dpaperh = 100;
double m_dpaperw = 100;
int m_layouts = 1;
bool m_busehlr = true;
m_dpaperw = pdfpageparams().getpaperheight();
m_dpaperh = pdfpageparams().getpaperwidth();
if (!m_benablelayers)
m_bexportofflayers = false;
bool bv15 = m_benablelayers || m_bexportofflayers;
pdfparams.pdb = pdb;
pdfparams.ver = bv15 ? pdfexportparams::kpdfv1_5 : pdfexportparams::kpdfv1_4;
pdfparams.outputstream
= odsystemservices()->createfile(odstring(m_exportfilename.c_str()), oda::kfilewrite, oda::ksharedenyno, oda::kcreatealways);
pdfparams.flags = pdfexportparams:

dfexportflags
(
(m_bembedded ? pdfexportparams::kembededttf : 0) |
(m_bshxasgeometry ? pdfexportparams::kshxtextasgeometry : 0) |
(m_bttfasgeometry ? pdfexportparams::kttftextasgeometry : 0) |
(m_bsimplegeomopt ? pdfexportparams::ksimplegeomoptimization : 0) |
(m_bzoomtoextents ? pdfexportparams::kzoomtoextentsmode : 0) |
(m_benablelayers ? pdfexportparams::kenablelayers : 0) |
(m_bexportofflayers ? pdfexportparams::kincludeofflayers : 0) );
pdfparams.title = "";
pdfparams.author = "";
pdfparams.subject = "";
pdfparams.keywords = "";
pdfparams.creator = "";
pdfparams.producer = "";
pdfparams.busehlr = m_busehlr != 0;
if (m_layouts == 1)
{
oddbdictionaryptr playoutdict = pdb->getlayoutdictionaryid().safeopenobject();
oddbdictionaryiteratorptr pit = playoutdict->newiterator();
while(!pit->done())
{
oddblayoutptr playout = pit->getobject();
odstring sname = playout->getlayoutname();
if (playout->getblocktablerecordid() == pdb->getmodelspaceid())
{
pdfparams.layouts.insertat(0, sname);
}
else
{
oddbblocktablerecordptr prec = playout->getblocktablerecordid().safeopenobject();
oddbobjectiteratorptr pit = prec->newiterator();
bool bempty = pit->done();
if (!bempty)
pdfparams.layouts.push_back(sname);
}
pit->next();
}
}
oduint32 npages = odmax(1, pdfparams.layouts.size());
pdfpageparams pageparams;
pageparams.set(m_dpaperw, m_dpaperh);
pdfparams.pageparams.resize(npages, pageparams);
oduint32 errcode = exportpdf(pdfparams);
}
}
in order to make dwgdirect using shx fonts from a specific folder you can override oddbhostappservices::findfile() or use "acad" system environment variable.
for details see developer's guide/introduction/font handling.
sergey slezkin