Skip to content

Commit

Permalink
ISSUE #695 updated file processors to rely on updated svg exporter to…
Browse files Browse the repository at this point in the history
… write width and head attributes
  • Loading branch information
sebjf committed Sep 24, 2024
1 parent 37e4f97 commit 8353f93
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -358,21 +358,10 @@ void FileProcessorDgn::importDrawing(OdDgDatabasePtr pDb, const ODCOLORREF* pPal

// Finally copy the contents of the stream to the collector's buffer

// Copy the SVG contents into a string

std::vector<char> buffer;
std::vector<uint8_t> buffer;
buffer.resize(stream->tell());
stream->seek(0, OdDb::FilerSeekType::kSeekFromStart);
stream->getBytes(buffer.data(), stream->length());
std::string svg(buffer.data(), buffer.size());

// Perform any further necessary manipulations. In this case we add the width
// and height attributes.

svg.insert(61, "width=\"1024\" height=\"768\" "); // 61 is just after the svg tag. This offset is fixed for exporter version.

// Provide the string to the collector as a vector

std::copy(svg.c_str(), svg.c_str() + svg.length(), std::back_inserter(drawingCollector->data));
drawingCollector->data = buffer;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -167,22 +167,13 @@ void FileProcessorDwg::importDrawing(OdDbDatabasePtr pDb)

pHelperDevice->update();

// Copy the SVG contents into a string
// And assign the contents to the collector's buffer

std::vector<char> buffer;
std::vector<uint8_t> buffer;
buffer.resize(stream->tell());
stream->seek(0, OdDb::FilerSeekType::kSeekFromStart);
stream->getBytes(buffer.data(), stream->length());
std::string svg(buffer.data(), buffer.size());

// Perform any further necessary manipulations. In this case we add the width
// and height attributes.

svg.insert(61, "width=\"1024\" height=\"768\" "); // 61 is just after the svg tag. This offset is fixed for exporter version.

// Provide the string to the collector as a vector

std::copy(svg.c_str(), svg.c_str() + svg.length(), std::back_inserter(drawingCollector->data));
drawingCollector->data = buffer;
}
}

Expand Down
2 changes: 1 addition & 1 deletion submodules/svgexport

0 comments on commit 8353f93

Please sign in to comment.