>scan a code book for instance into an actual text document
Unless your intended action falls within the category of "fair use," you may be running afoul of the books' copyrights. If you copy, publish, or distribute the material in any form other than a short "quotation," you are probably violating copyright law.
Building codes in the US, for instance, are usually not in the public domain, even though they are adopted by govenment agencies. For example, the International Residential Code says on its first page that it is "a copyrighted work
owned by the International Code Council, Inc. Without advance written permission from the copyright owner, no part of this book may be reproduced, distributed, or transmitted in any form or by any means, including, without limitation, electronic, optical or mechanical means."